diff mbox

memory: omap-gpmc: Delete an unnecessary check before the function call "gpiochip_free_own_desc"

Message ID e3f6205c-39a0-b9f7-5290-be4c6cbb2f0b@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring July 23, 2016, 5:09 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 23 Jul 2016 18:54:02 +0200

The gpiochip_free_own_desc() 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/memory/omap-gpmc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Roger Quadros Aug. 1, 2016, 9:32 a.m. UTC | #1
Hi Markus,

On 23/07/16 20:09, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 23 Jul 2016 18:54:02 +0200
> 
> The gpiochip_free_own_desc() 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/memory/omap-gpmc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index 869c83f..e138875 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2143,9 +2143,7 @@ err_child_fail:
>  	ret = -ENODEV;
>  
>  err_cs:
> -	if (waitpin_desc)
> -		gpiochip_free_own_desc(waitpin_desc);
> -
> +	gpiochip_free_own_desc(waitpin_desc);
>  err:
>  	gpmc_cs_free(cs);
>  
> 
This looks good to me. I will queue this for v4.8. Thanks.

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" 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/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 869c83f..e138875 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2143,9 +2143,7 @@  err_child_fail:
 	ret = -ENODEV;
 
 err_cs:
-	if (waitpin_desc)
-		gpiochip_free_own_desc(waitpin_desc);
-
+	gpiochip_free_own_desc(waitpin_desc);
 err:
 	gpmc_cs_free(cs);