diff mbox

[v2,5/7] Xen / ACPI / processor: Remove unneeded NULL check in xen_acpi_processor_enable()

Message ID 1430793998-21631-6-git-send-email-hanjun.guo@linaro.org (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Hanjun Guo May 5, 2015, 2:46 a.m. UTC
Before xen_acpi_processor_enable() is called, struct acpi_processor *pr is
allocated in xen_acpi_processor_add() and checked if it's NULL, so no need
to check again when passed to xen_acpi_processor_enable(), just remove it.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 drivers/xen/xen-acpi-cpuhotplug.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Stefano Stabellini May 5, 2015, 10:29 a.m. UTC | #1
CC'ing Konrad and David.

On Tue, 5 May 2015, Hanjun Guo wrote:
> Before xen_acpi_processor_enable() is called, struct acpi_processor *pr is
> allocated in xen_acpi_processor_add() and checked if it's NULL, so no need
> to check again when passed to xen_acpi_processor_enable(), just remove it.
> 
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  drivers/xen/xen-acpi-cpuhotplug.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c
> index 5a62aa0..f4a3694 100644
> --- a/drivers/xen/xen-acpi-cpuhotplug.c
> +++ b/drivers/xen/xen-acpi-cpuhotplug.c
> @@ -46,13 +46,7 @@ static int xen_acpi_processor_enable(struct acpi_device *device)
>  	unsigned long long value;
>  	union acpi_object object = { 0 };
>  	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
> -	struct acpi_processor *pr;
> -
> -	pr = acpi_driver_data(device);
> -	if (!pr) {
> -		pr_err(PREFIX "Cannot find driver data\n");
> -		return -EINVAL;
> -	}
> +	struct acpi_processor *pr = acpi_driver_data(device);
>  
>  	if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
>  		/* Declared with "Processor" statement; match ProcessorID */
> -- 
> 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Konrad Rzeszutek Wilk May 9, 2015, 10:06 p.m. UTC | #2
On Tue, May 05, 2015 at 11:29:05AM +0100, Stefano Stabellini wrote:
> CC'ing Konrad and David.
> 
> On Tue, 5 May 2015, Hanjun Guo wrote:
> > Before xen_acpi_processor_enable() is called, struct acpi_processor *pr is
> > allocated in xen_acpi_processor_add() and checked if it's NULL, so no need
> > to check again when passed to xen_acpi_processor_enable(), just remove it.

Sounds right.

> > 
> > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > ---
> >  drivers/xen/xen-acpi-cpuhotplug.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c
> > index 5a62aa0..f4a3694 100644
> > --- a/drivers/xen/xen-acpi-cpuhotplug.c
> > +++ b/drivers/xen/xen-acpi-cpuhotplug.c
> > @@ -46,13 +46,7 @@ static int xen_acpi_processor_enable(struct acpi_device *device)
> >  	unsigned long long value;
> >  	union acpi_object object = { 0 };
> >  	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
> > -	struct acpi_processor *pr;
> > -
> > -	pr = acpi_driver_data(device);
> > -	if (!pr) {
> > -		pr_err(PREFIX "Cannot find driver data\n");
> > -		return -EINVAL;
> > -	}
> > +	struct acpi_processor *pr = acpi_driver_data(device);
> >  
> >  	if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
> >  		/* Declared with "Processor" statement; match ProcessorID */
> > -- 
> > 1.9.1
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c
index 5a62aa0..f4a3694 100644
--- a/drivers/xen/xen-acpi-cpuhotplug.c
+++ b/drivers/xen/xen-acpi-cpuhotplug.c
@@ -46,13 +46,7 @@  static int xen_acpi_processor_enable(struct acpi_device *device)
 	unsigned long long value;
 	union acpi_object object = { 0 };
 	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
-	struct acpi_processor *pr;
-
-	pr = acpi_driver_data(device);
-	if (!pr) {
-		pr_err(PREFIX "Cannot find driver data\n");
-		return -EINVAL;
-	}
+	struct acpi_processor *pr = acpi_driver_data(device);
 
 	if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
 		/* Declared with "Processor" statement; match ProcessorID */