All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 -next] media: atomisp: Remove unneeded if-null-free check
@ 2021-06-02  1:45 Zheng Yongjun
  2021-06-02  6:13 ` Dan Carpenter
  2021-06-02 19:23 ` Fabio M. De Francesco
  0 siblings, 2 replies; 3+ messages in thread
From: Zheng Yongjun @ 2021-06-02  1:45 UTC (permalink / raw)
  To: mchehab, linux-media, linux-staging, linux-kernel
  Cc: sakari.ailus, gregkh, Zheng Yongjun

Eliminate the following coccicheck warning:

drivers/staging/media/atomisp/pci/sh_css_firmware.c:367:4-10: WARNING:
NULL check before some freeing functions is not needed.
drivers/staging/media/atomisp/pci/sh_css_firmware.c:369:4-10: WARNING:
NULL check before some freeing functions is not needed.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 drivers/staging/media/atomisp/pci/sh_css_firmware.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
index f4ce8ace9d50..5301cc014c7e 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
@@ -363,10 +363,8 @@ void sh_css_unload_firmware(void)
 		unsigned int i = 0;
 
 		for (i = 0; i < sh_css_num_binaries; i++) {
-			if (fw_minibuffer[i].name)
-				kfree((void *)fw_minibuffer[i].name);
-			if (fw_minibuffer[i].buffer)
-				kvfree(fw_minibuffer[i].buffer);
+			kfree((void *)fw_minibuffer[i].name);
+			kvfree(fw_minibuffer[i].buffer);
 		}
 		kfree(fw_minibuffer);
 		fw_minibuffer = NULL;
-- 
2.25.1


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

* Re: [PATCH v2 -next] media: atomisp: Remove unneeded if-null-free check
  2021-06-02  1:45 [PATCH v2 -next] media: atomisp: Remove unneeded if-null-free check Zheng Yongjun
@ 2021-06-02  6:13 ` Dan Carpenter
  2021-06-02 19:23 ` Fabio M. De Francesco
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-06-02  6:13 UTC (permalink / raw)
  To: Zheng Yongjun
  Cc: mchehab, linux-media, linux-staging, linux-kernel, sakari.ailus, gregkh

On Wed, Jun 02, 2021 at 09:45:47AM +0800, Zheng Yongjun wrote:
> Eliminate the following coccicheck warning:
> 
> drivers/staging/media/atomisp/pci/sh_css_firmware.c:367:4-10: WARNING:
> NULL check before some freeing functions is not needed.
> drivers/staging/media/atomisp/pci/sh_css_firmware.c:369:4-10: WARNING:
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  drivers/staging/media/atomisp/pci/sh_css_firmware.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
> index f4ce8ace9d50..5301cc014c7e 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
> @@ -363,10 +363,8 @@ void sh_css_unload_firmware(void)
>  		unsigned int i = 0;
>  
>  		for (i = 0; i < sh_css_num_binaries; i++) {
> -			if (fw_minibuffer[i].name)
> -				kfree((void *)fw_minibuffer[i].name);
> -			if (fw_minibuffer[i].buffer)
> -				kvfree(fw_minibuffer[i].buffer);
> +			kfree((void *)fw_minibuffer[i].name);

Sorry, I should have mentioned this.  Remove the cast as well.

			kfree(fw_minibuffer[i].name);

regards,
dan carpenter

> +			kvfree(fw_minibuffer[i].buffer);
>  		}


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

* Re: [PATCH v2 -next] media: atomisp: Remove unneeded if-null-free check
  2021-06-02  1:45 [PATCH v2 -next] media: atomisp: Remove unneeded if-null-free check Zheng Yongjun
  2021-06-02  6:13 ` Dan Carpenter
@ 2021-06-02 19:23 ` Fabio M. De Francesco
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio M. De Francesco @ 2021-06-02 19:23 UTC (permalink / raw)
  To: mchehab, linux-media, linux-staging, linux-kernel, Zheng Yongjun
  Cc: sakari.ailus, gregkh, Zheng Yongjun

On Wednesday, June 2, 2021 3:45:47 AM CEST Zheng Yongjun wrote:
> Eliminate the following coccicheck warning:
> 
> drivers/staging/media/atomisp/pci/sh_css_firmware.c:367:4-10: WARNING:
> NULL check before some freeing functions is not needed.
> drivers/staging/media/atomisp/pci/sh_css_firmware.c:369:4-10: WARNING:
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  drivers/staging/media/atomisp/pci/sh_css_firmware.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
This warning has already been fixed on May 27th (with the only exception of 
the removal of the unneeded cast):

[PATCH] staging: media: atomisp: pci: Remove checks before kfree/kvfree
https://lore.kernel.org/lkml/20210527193922.25225-1-fmdefrancesco@gmail.com/

Fabio
>
> diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c
> b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index 
f4ce8ace9d50..5301cc014c7e
> 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
> @@ -363,10 +363,8 @@ void sh_css_unload_firmware(void)
>  		unsigned int i = 0;
> 
>  		for (i = 0; i < sh_css_num_binaries; i++) {
> -			if (fw_minibuffer[i].name)
> -				kfree((void 
*)fw_minibuffer[i].name);
> -			if (fw_minibuffer[i].buffer)
> -				kvfree(fw_minibuffer[i].buffer);
> +			kfree((void *)fw_minibuffer[i].name);
> +			kvfree(fw_minibuffer[i].buffer);
>  		}
>  		kfree(fw_minibuffer);
>  		fw_minibuffer = NULL;





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

end of thread, other threads:[~2021-06-02 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  1:45 [PATCH v2 -next] media: atomisp: Remove unneeded if-null-free check Zheng Yongjun
2021-06-02  6:13 ` Dan Carpenter
2021-06-02 19:23 ` Fabio M. De Francesco

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.