linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree
@ 2021-06-05  2:08 Fabio M. De Francesco
  2021-06-05  2:08 ` [PATCH v2 1/2] staging: media: atomisp: pci: Remove checks " Fabio M. De Francesco
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fabio M. De Francesco @ 2021-06-05  2:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	Dan Carpenter, linux-media, linux-staging, linux-kernel
  Cc: Fabio M. De Francesco

(1/2) Removed unnecessary test of pointers != NULL before passing them to
kfree() and kvfree(). 
(2/2) Removed an unncecessary (void *) cast for an argument passed to kfree().

v1 -> v2: Added patch 2/2.

Fabio M. De Francesco (2):
  staging: media: atomisp: pci: Remove checks before kfree/kvfree
  staging: media: atomisp: pci: Remove unnecessary (void *) cast

 drivers/staging/media/atomisp/pci/sh_css_firmware.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.31.1


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

* [PATCH v2 1/2] staging: media: atomisp: pci: Remove checks before kfree/kvfree
  2021-06-05  2:08 [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
@ 2021-06-05  2:08 ` Fabio M. De Francesco
  2021-06-05  2:08 ` [PATCH v2 2/2] staging: media: atomisp: pci: Remove unnecessary (void *) cast Fabio M. De Francesco
  2021-06-14 16:33 ` [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
  2 siblings, 0 replies; 5+ messages in thread
From: Fabio M. De Francesco @ 2021-06-05  2:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	Dan Carpenter, linux-media, linux-staging, linux-kernel
  Cc: Fabio M. De Francesco

Removed checks for pointers != NULL before freeing memory. If kvfree()
and kfree() are given NULL pointers no operations are performed, so
there is no need for the above-mentioned checks. Coccinelle detected the
second of the two unnecessary checks.

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---

v1 -> v2: Added Acked-by Sakari Alius. No changes in code.

 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.31.1


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

* [PATCH v2 2/2] staging: media: atomisp: pci: Remove unnecessary (void *) cast
  2021-06-05  2:08 [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
  2021-06-05  2:08 ` [PATCH v2 1/2] staging: media: atomisp: pci: Remove checks " Fabio M. De Francesco
@ 2021-06-05  2:08 ` Fabio M. De Francesco
  2021-06-14 16:33 ` [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
  2 siblings, 0 replies; 5+ messages in thread
From: Fabio M. De Francesco @ 2021-06-05  2:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	Dan Carpenter, linux-media, linux-staging, linux-kernel
  Cc: Fabio M. De Francesco

Removed an unnecessary (void *) cast for an argument passed to kfree().

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---

v1 -> v2: Added this 2/2 patch.

 drivers/staging/media/atomisp/pci/sh_css_firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


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

* Re: [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree
  2021-06-05  2:08 [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
  2021-06-05  2:08 ` [PATCH v2 1/2] staging: media: atomisp: pci: Remove checks " Fabio M. De Francesco
  2021-06-05  2:08 ` [PATCH v2 2/2] staging: media: atomisp: pci: Remove unnecessary (void *) cast Fabio M. De Francesco
@ 2021-06-14 16:33 ` Fabio M. De Francesco
  2021-06-14 16:44   ` Mauro Carvalho Chehab
  2 siblings, 1 reply; 5+ messages in thread
From: Fabio M. De Francesco @ 2021-06-14 16:33 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	Dan Carpenter, linux-media, linux-staging, linux-kernel

Hi All,

I've seen that some patches of mine, more recent the following ones, have 
already been applied. In the past I had noticed that the patches are 
(usually?) placed in a time of submission ordered FIFO, unless they are 
rejected.

I'm wondering if I should re-send them or if I am missing some details about 
the specific workflow of staging/media.

Thanks,

Fabio

On Saturday, June 5, 2021 4:08:53 AM CEST Fabio M. De Francesco wrote:
> (1/2) Removed unnecessary test of pointers != NULL before passing them to
> kfree() and kvfree().
> (2/2) Removed an unnecessary (void *) cast for an argument passed to 
kfree().
> 
> v1 -> v2: Added patch 2/2.
> 
> Fabio M. De Francesco (2):
>   staging: media: atomisp: pci: Remove checks before kfree/kvfree
>   staging: media: atomisp: pci: Remove unnecessary (void *) cast
> 
>  drivers/staging/media/atomisp/pci/sh_css_firmware.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)





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

* Re: [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree
  2021-06-14 16:33 ` [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
@ 2021-06-14 16:44   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2021-06-14 16:44 UTC (permalink / raw)
  To: Fabio M. De Francesco
  Cc: Sakari Ailus, Greg Kroah-Hartman, Dan Carpenter, linux-media,
	linux-staging, linux-kernel

Em Mon, 14 Jun 2021 18:33:55 +0200
"Fabio M. De Francesco" <fmdefrancesco@gmail.com> escreveu:

> Hi All,
> 
> I've seen that some patches of mine, more recent the following ones, have 
> already been applied. In the past I had noticed that the patches are 
> (usually?) placed in a time of submission ordered FIFO, unless they are 
> rejected.
> 
> I'm wondering if I should re-send them or if I am missing some details about 
> the specific workflow of staging/media.

Any patches sent to linux-media@vger.kernel.org are automatically stored
at patchwork:

	https://patchwork.linuxtv.org/project/linux-media/list/

If the patches you sent are there and are marked with "New" state,
there's no need to re-submit. On a quick check, there are 3 media
patches from you there:

	https://patchwork.linuxtv.org/project/linux-media/list/?series=&submitter=8492&state=&q=&archive=&delegate=
	
No need to resubmit those, except if some reviewer asks you to
change your patch(es).

Thanks,
Mauro

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

end of thread, other threads:[~2021-06-14 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05  2:08 [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
2021-06-05  2:08 ` [PATCH v2 1/2] staging: media: atomisp: pci: Remove checks " Fabio M. De Francesco
2021-06-05  2:08 ` [PATCH v2 2/2] staging: media: atomisp: pci: Remove unnecessary (void *) cast Fabio M. De Francesco
2021-06-14 16:33 ` [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree Fabio M. De Francesco
2021-06-14 16:44   ` Mauro Carvalho Chehab

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).