linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
@ 2014-11-02 15:12                                   ` SF Markus Elfring
  2014-11-11  4:07                                     ` Bjorn Helgaas
  2014-11-30 10:08                                   ` [PATCH 1/1] ACPI: Deletion of an unnecessary check before the function call "pci_dev_put" SF Markus Elfring
                                                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2014-11-02 15:12 UTC (permalink / raw)
  To: Bjorn Helgaas, Boris Ostrovsky, David Vrabel,
	Konrad Rzeszutek Wilk, Len Brown, Rafael J. Wysocki, linux-pci
  Cc: linux-acpi, linux-kernel, xen-devel, kernel-janitors, trivial,
	Coccinelle

The functions pci_dev_put(), pci_pme_wakeup_bus() and put_device() test
whether their argument is NULL and then return immediately. Thus the test
around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pci/pci-acpi.c     | 3 +--
 drivers/pci/probe.c        | 3 +--
 drivers/pci/search.c       | 3 +--
 drivers/pci/xen-pcifront.c | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 37263b0..a8fe5de 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -60,8 +60,7 @@ static void pci_acpi_wake_dev(struct work_struct *work)
 	pci_wakeup_event(pci_dev);
 	pm_runtime_resume(&pci_dev->dev);

-	if (pci_dev->subordinate)
-		pci_pme_wakeup_bus(pci_dev->subordinate);
+	pci_pme_wakeup_bus(pci_dev->subordinate);
 }

 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4170113..e93f16e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -86,8 +86,7 @@ static void release_pcibus_dev(struct device *dev)
 {
 	struct pci_bus *pci_bus = to_pci_bus(dev);

-	if (pci_bus->bridge)
-		put_device(pci_bus->bridge);
+	put_device(pci_bus->bridge);
 	pci_bus_remove_resources(pci_bus);
 	pci_release_bus_of_node(pci_bus);
 	kfree(pci_bus);
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 827ad83..2d806bd 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -305,8 +305,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct
pci_device_id *id,
 			      match_pci_dev_by_id);
 	if (dev)
 		pdev = to_pci_dev(dev);
-	if (from)
-		pci_dev_put(from);
+	pci_dev_put(from);
 	return pdev;
 }

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 53df39a..46664cc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -596,8 +596,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
 	pcidev = pci_get_bus_and_slot(bus, devfn);
 	if (!pcidev || !pcidev->driver) {
 		dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
-		if (pcidev)
-			pci_dev_put(pcidev);
+		pci_dev_put(pcidev);
 		return result;
 	}
 	pdrv = pcidev->driver;
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls
  2014-11-02 15:12                                   ` [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls SF Markus Elfring
@ 2014-11-11  4:07                                     ` Bjorn Helgaas
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2014-11-11  4:07 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Boris Ostrovsky, David Vrabel, Konrad Rzeszutek Wilk, Len Brown,
	Rafael J. Wysocki, linux-pci, linux-acpi, linux-kernel, xen-devel,
	kernel-janitors, trivial, Coccinelle

On Sun, Nov 02, 2014 at 04:12:30PM +0100, SF Markus Elfring wrote:
> The functions pci_dev_put(), pci_pme_wakeup_bus() and put_device() test
> whether their argument is NULL and then return immediately. Thus the test
> around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Applied to pci/misc for v3.19, thanks!

> ---
>  drivers/pci/pci-acpi.c     | 3 +--
>  drivers/pci/probe.c        | 3 +--
>  drivers/pci/search.c       | 3 +--
>  drivers/pci/xen-pcifront.c | 3 +--
>  4 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 37263b0..a8fe5de 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -60,8 +60,7 @@ static void pci_acpi_wake_dev(struct work_struct *work)
>  	pci_wakeup_event(pci_dev);
>  	pm_runtime_resume(&pci_dev->dev);
> 
> -	if (pci_dev->subordinate)
> -		pci_pme_wakeup_bus(pci_dev->subordinate);
> +	pci_pme_wakeup_bus(pci_dev->subordinate);
>  }
> 
>  /**
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 4170113..e93f16e 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -86,8 +86,7 @@ static void release_pcibus_dev(struct device *dev)
>  {
>  	struct pci_bus *pci_bus = to_pci_bus(dev);
> 
> -	if (pci_bus->bridge)
> -		put_device(pci_bus->bridge);
> +	put_device(pci_bus->bridge);
>  	pci_bus_remove_resources(pci_bus);
>  	pci_release_bus_of_node(pci_bus);
>  	kfree(pci_bus);
> diff --git a/drivers/pci/search.c b/drivers/pci/search.c
> index 827ad83..2d806bd 100644
> --- a/drivers/pci/search.c
> +++ b/drivers/pci/search.c
> @@ -305,8 +305,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct
> pci_device_id *id,
>  			      match_pci_dev_by_id);
>  	if (dev)
>  		pdev = to_pci_dev(dev);
> -	if (from)
> -		pci_dev_put(from);
> +	pci_dev_put(from);
>  	return pdev;
>  }
> 
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 53df39a..46664cc 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -596,8 +596,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
>  	pcidev = pci_get_bus_and_slot(bus, devfn);
>  	if (!pcidev || !pcidev->driver) {
>  		dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
> -		if (pcidev)
> -			pci_dev_put(pcidev);
> +		pci_dev_put(pcidev);
>  		return result;
>  	}
>  	pdrv = pcidev->driver;
> -- 
> 2.1.3
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/1] ACPI: Deletion of an unnecessary check before the function call "pci_dev_put"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
  2014-11-02 15:12                                   ` [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls SF Markus Elfring
@ 2014-11-30 10:08                                   ` SF Markus Elfring
  2015-06-24 10:32                                   ` ACPI-APEI: Make exception handling a bit more efficient in __einj_error_trigger() SF Markus Elfring
                                                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2014-11-30 10:08 UTC (permalink / raw)
  To: Len Brown, Rafael J. Wysocki, linux-acpi
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 30 Nov 2014 10:59:10 +0100

The pci_dev_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/ioapic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index 9a631a6..35963d3 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -185,8 +185,7 @@ exit_disable:
 	if (dev)
 		pci_disable_device(dev);
 exit_put:
-	if (dev)
-		pci_dev_put(dev);
+	pci_dev_put(dev);
 exit_free:
 	kfree(ioapic);
 exit:
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ACPI-APEI: Make exception handling a bit more efficient in __einj_error_trigger()
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
  2014-11-02 15:12                                   ` [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls SF Markus Elfring
  2014-11-30 10:08                                   ` [PATCH 1/1] ACPI: Deletion of an unnecessary check before the function call "pci_dev_put" SF Markus Elfring
@ 2015-06-24 10:32                                   ` SF Markus Elfring
  2015-06-24 11:45                                   ` [PATCH] ACPICA: Delete an unnecessary check before the function call "acpi_ds_delete_walk_state" SF Markus Elfring
                                                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2015-06-24 10:32 UTC (permalink / raw)
  To: Len Brown, Rafael J. Wysocki, linux-acpi; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jun 2015 11:41:46 +0200

Return from the __einj_error_trigger() function directly after a failed
call for the request_mem_region() function according to the current Linux
coding style convention.

Drop an unnecessary initialisation for the variable "trigger_tab" then.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/apei/einj.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index a095d4f..c3a2c06 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -299,7 +299,7 @@ static struct acpi_generic_address *einj_get_trigger_parameter_region(
 static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 				u64 param1, u64 param2)
 {
-	struct acpi_einj_trigger *trigger_tab = NULL;
+	struct acpi_einj_trigger *trigger_tab;
 	struct apei_exec_context trigger_ctx;
 	struct apei_resources trigger_resources;
 	struct acpi_whea_header *trigger_entry;
@@ -316,7 +316,7 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 		       (unsigned long long)trigger_paddr,
 		       (unsigned long long)trigger_paddr +
 			    sizeof(*trigger_tab) - 1);
-		goto out;
+		return rc;
 	}
 	trigger_tab = ioremap_cache(trigger_paddr, sizeof(*trigger_tab));
 	if (!trigger_tab) {
@@ -407,7 +407,7 @@ out_rel_entry:
 			   table_size - sizeof(*trigger_tab));
 out_rel_header:
 	release_mem_region(trigger_paddr, sizeof(*trigger_tab));
-out:
+
 	if (trigger_tab)
 		iounmap(trigger_tab);
 
-- 
2.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] ACPICA: Delete an unnecessary check before the function call "acpi_ds_delete_walk_state"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
                                                     ` (2 preceding siblings ...)
  2015-06-24 10:32                                   ` ACPI-APEI: Make exception handling a bit more efficient in __einj_error_trigger() SF Markus Elfring
@ 2015-06-24 11:45                                   ` SF Markus Elfring
  2015-06-24 15:16                                     ` Moore, Robert
  2015-11-05 15:22                                   ` [PATCH] ACPICA: Delete unnecessary checks before the function call "acpi_ut_strupr" SF Markus Elfring
  2015-11-15 21:52                                   ` [PATCH] ACPI-EC: Delete an unnecessary check before the function call "acpi_ec_delete_query" SF Markus Elfring
  5 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2015-06-24 11:45 UTC (permalink / raw)
  To: Len Brown, Lv Zheng, Rafael J. Wysocki, Robert Moore, linux-acpi,
	devel
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jun 2015 13:33:47 +0200

The acpi_ds_delete_walk_state() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/acpica/dsmethod.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 85bb951..188b254 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -574,10 +574,7 @@ cleanup:
 	/* On error, we must terminate the method properly */
 
 	acpi_ds_terminate_control_method(obj_desc, next_walk_state);
-	if (next_walk_state) {
-		acpi_ds_delete_walk_state(next_walk_state);
-	}
-
+	acpi_ds_delete_walk_state(next_walk_state);
 	return_ACPI_STATUS(status);
 }
 
-- 
2.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH] ACPICA: Delete an unnecessary check before the function call "acpi_ds_delete_walk_state"
  2015-06-24 11:45                                   ` [PATCH] ACPICA: Delete an unnecessary check before the function call "acpi_ds_delete_walk_state" SF Markus Elfring
@ 2015-06-24 15:16                                     ` Moore, Robert
  0 siblings, 0 replies; 9+ messages in thread
From: Moore, Robert @ 2015-06-24 15:16 UTC (permalink / raw)
  To: SF Markus Elfring, Len Brown, Zheng, Lv, Wysocki, Rafael J,
	linux-acpi@vger.kernel.org, devel@acpica.org
  Cc: LKML, kernel-janitors@vger.kernel.org, Julia Lawall

Got it, thanks.


> -----Original Message-----
> From: SF Markus Elfring [mailto:elfring@users.sourceforge.net]
> Sent: Wednesday, June 24, 2015 4:46 AM
> To: Len Brown; Zheng, Lv; Wysocki, Rafael J; Moore, Robert; linux-
> acpi@vger.kernel.org; devel@acpica.org
> Cc: LKML; kernel-janitors@vger.kernel.org; Julia Lawall
> Subject: [PATCH] ACPICA: Delete an unnecessary check before the function
> call "acpi_ds_delete_walk_state"
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 24 Jun 2015 13:33:47 +0200
> 
> The acpi_ds_delete_walk_state() function tests whether its argument is
> NULL and then returns immediately. Thus the test around the call is not
> needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/acpi/acpica/dsmethod.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/dsmethod.c
> b/drivers/acpi/acpica/dsmethod.c index 85bb951..188b254 100644
> --- a/drivers/acpi/acpica/dsmethod.c
> +++ b/drivers/acpi/acpica/dsmethod.c
> @@ -574,10 +574,7 @@ cleanup:
>  	/* On error, we must terminate the method properly */
> 
>  	acpi_ds_terminate_control_method(obj_desc, next_walk_state);
> -	if (next_walk_state) {
> -		acpi_ds_delete_walk_state(next_walk_state);
> -	}
> -
> +	acpi_ds_delete_walk_state(next_walk_state);
>  	return_ACPI_STATUS(status);
>  }
> 
> --
> 2.4.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ACPICA: Delete unnecessary checks before the function call "acpi_ut_strupr"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
                                                     ` (3 preceding siblings ...)
  2015-06-24 11:45                                   ` [PATCH] ACPICA: Delete an unnecessary check before the function call "acpi_ds_delete_walk_state" SF Markus Elfring
@ 2015-11-05 15:22                                   ` SF Markus Elfring
  2015-11-05 16:28                                     ` Moore, Robert
  2015-11-15 21:52                                   ` [PATCH] ACPI-EC: Delete an unnecessary check before the function call "acpi_ec_delete_query" SF Markus Elfring
  5 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2015-11-05 15:22 UTC (permalink / raw)
  To: Len Brown, Lv Zheng, Rafael J. Wysocki, Robert Moore, linux-acpi,
	devel
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Nov 2015 16:12:32 +0100

The acpi_ut_strupr() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/acpica/dbcmds.c  | 9 ++-------
 drivers/acpi/acpica/dbinput.c | 5 +----
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/acpica/dbcmds.c b/drivers/acpi/acpica/dbcmds.c
index 30414b3..7dcc95a 100644
--- a/drivers/acpi/acpica/dbcmds.c
+++ b/drivers/acpi/acpica/dbcmds.c
@@ -1131,13 +1131,8 @@ void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg)
 	u32 debug_layer = 0;
 	u32 flags = 0;
 
-	if (enable_arg) {
-		acpi_ut_strupr(enable_arg);
-	}
-
-	if (once_arg) {
-		acpi_ut_strupr(once_arg);
-	}
+	acpi_ut_strupr(enable_arg);
+	acpi_ut_strupr(once_arg);
 
 	if (method_arg) {
 		if (acpi_db_trace_method_name) {
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
index 0480254..aa1dcee 100644
--- a/drivers/acpi/acpica/dbinput.c
+++ b/drivers/acpi/acpica/dbinput.c
@@ -622,10 +622,7 @@ static u32 acpi_db_get_line(char *input_buffer)
 	}
 
 	/* Uppercase the actual command */
-
-	if (acpi_gbl_db_args[0]) {
-		acpi_ut_strupr(acpi_gbl_db_args[0]);
-	}
+	acpi_ut_strupr(acpi_gbl_db_args[0]);
 
 	count = i;
 	if (count) {
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH] ACPICA: Delete unnecessary checks before the function call "acpi_ut_strupr"
  2015-11-05 15:22                                   ` [PATCH] ACPICA: Delete unnecessary checks before the function call "acpi_ut_strupr" SF Markus Elfring
@ 2015-11-05 16:28                                     ` Moore, Robert
  0 siblings, 0 replies; 9+ messages in thread
From: Moore, Robert @ 2015-11-05 16:28 UTC (permalink / raw)
  To: SF Markus Elfring, Len Brown, Zheng, Lv, Wysocki, Rafael J,
	linux-acpi@vger.kernel.org, devel@acpica.org
  Cc: LKML, kernel-janitors@vger.kernel.org, Julia Lawall

Agreed, we will implement your suggestions in the ACPICA code (which is in a different format than the Linux version).


> -----Original Message-----
> From: SF Markus Elfring [mailto:elfring@users.sourceforge.net]
> Sent: Thursday, November 05, 2015 7:23 AM
> To: Len Brown; Zheng, Lv; Wysocki, Rafael J; Moore, Robert; linux-
> acpi@vger.kernel.org; devel@acpica.org
> Cc: LKML; kernel-janitors@vger.kernel.org; Julia Lawall
> Subject: [PATCH] ACPICA: Delete unnecessary checks before the function
> call "acpi_ut_strupr"
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 5 Nov 2015 16:12:32 +0100
> 
> The acpi_ut_strupr() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/acpi/acpica/dbcmds.c  | 9 ++-------
> drivers/acpi/acpica/dbinput.c | 5 +----
>  2 files changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/dbcmds.c b/drivers/acpi/acpica/dbcmds.c
> index 30414b3..7dcc95a 100644
> --- a/drivers/acpi/acpica/dbcmds.c
> +++ b/drivers/acpi/acpica/dbcmds.c
> @@ -1131,13 +1131,8 @@ void acpi_db_trace(char *enable_arg, char
> *method_arg, char *once_arg)
>  	u32 debug_layer = 0;
>  	u32 flags = 0;
> 
> -	if (enable_arg) {
> -		acpi_ut_strupr(enable_arg);
> -	}
> -
> -	if (once_arg) {
> -		acpi_ut_strupr(once_arg);
> -	}
> +	acpi_ut_strupr(enable_arg);
> +	acpi_ut_strupr(once_arg);
> 
>  	if (method_arg) {
>  		if (acpi_db_trace_method_name) {
> diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
> index 0480254..aa1dcee 100644
> --- a/drivers/acpi/acpica/dbinput.c
> +++ b/drivers/acpi/acpica/dbinput.c
> @@ -622,10 +622,7 @@ static u32 acpi_db_get_line(char *input_buffer)
>  	}
> 
>  	/* Uppercase the actual command */
> -
> -	if (acpi_gbl_db_args[0]) {
> -		acpi_ut_strupr(acpi_gbl_db_args[0]);
> -	}
> +	acpi_ut_strupr(acpi_gbl_db_args[0]);
> 
>  	count = i;
>  	if (count) {
> --
> 2.6.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ACPI-EC: Delete an unnecessary check before the function call "acpi_ec_delete_query"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
                                                     ` (4 preceding siblings ...)
  2015-11-05 15:22                                   ` [PATCH] ACPICA: Delete unnecessary checks before the function call "acpi_ut_strupr" SF Markus Elfring
@ 2015-11-15 21:52                                   ` SF Markus Elfring
  5 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2015-11-15 21:52 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, linux-acpi
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Nov 2015 22:42:27 +0100

The acpi_ec_delete_query() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/ec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f61a7c8..b420fb4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1103,7 +1103,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
 	}
 
 err_exit:
-	if (result && q)
+	if (result)
 		acpi_ec_delete_query(q);
 	if (data)
 		*data = value;
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-15 21:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.so urceforge.net>
     [not found]                                 ` <5317A59D.4@users.sourceforge.net>
2014-11-02 15:12                                   ` [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls SF Markus Elfring
2014-11-11  4:07                                     ` Bjorn Helgaas
2014-11-30 10:08                                   ` [PATCH 1/1] ACPI: Deletion of an unnecessary check before the function call "pci_dev_put" SF Markus Elfring
2015-06-24 10:32                                   ` ACPI-APEI: Make exception handling a bit more efficient in __einj_error_trigger() SF Markus Elfring
2015-06-24 11:45                                   ` [PATCH] ACPICA: Delete an unnecessary check before the function call "acpi_ds_delete_walk_state" SF Markus Elfring
2015-06-24 15:16                                     ` Moore, Robert
2015-11-05 15:22                                   ` [PATCH] ACPICA: Delete unnecessary checks before the function call "acpi_ut_strupr" SF Markus Elfring
2015-11-05 16:28                                     ` Moore, Robert
2015-11-15 21:52                                   ` [PATCH] ACPI-EC: Delete an unnecessary check before the function call "acpi_ec_delete_query" SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).