2021-06-05 02:11:05

by Fabio M. De Francesco

[permalink] [raw]
Subject: [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree

(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


2021-06-05 02:11:22

by Fabio M. De Francesco

[permalink] [raw]
Subject: [PATCH v2 1/2] staging: media: atomisp: pci: Remove checks before kfree/kvfree

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 <[email protected]>
Acked-by: Sakari Ailus <[email protected]>
---

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

2021-06-05 02:13:02

by Fabio M. De Francesco

[permalink] [raw]
Subject: [PATCH v2 2/2] staging: media: atomisp: pci: Remove unnecessary (void *) cast

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

Suggested-by: Dan Carpenter <[email protected]>
Signed-off-by: Fabio M. De Francesco <[email protected]>
---

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

2021-06-14 16:36:52

by Fabio M. De Francesco

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree

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




2021-06-14 16:47:25

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Remove unnecessary tests and cast before kfree/kvfree

Em Mon, 14 Jun 2021 18:33:55 +0200
"Fabio M. De Francesco" <[email protected]> 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 [email protected] 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