Skip to contentSkip to conversation

net: tun: Remove redundant null checks before kfree

PATCH In review [email protected] 2 participants 3 messages Nov 29, 2022 – Dec 1, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: tun: Remove redundant null checks before kfree

From: Yushan Zhou <[email protected]>

Fix the following coccicheck warning:
./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
NULL check before some freeing functions is not needed.

---
 drivers/gpu/host1x/fence.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/host1x/fence.c +1 -2
index ecab72882192..05b36bfc8b74 100644
@@ -93,8 +93,7 @@ static void host1x_syncpt_fence_release(struct dma_fence *f)
 {
 	struct host1x_syncpt_fence *sf = to_host1x_fence(f);
 
-	if (sf->waiter)
-		kfree(sf->waiter);
+	kfree(sf->waiter);
 
 	dma_fence_free(f);
 }
Signature · 1 line
2.27.0
#1 lore raw

+ Thierry Reding, linux-tegra, dri-devel

Quoted 7 lines · On Tue, Nov 29, 2022 at 04:43:29PM +0800, [email protected] wrote:

From: Yushan Zhou <[email protected]>

Fix the following coccicheck warning:
./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
NULL check before some freeing functions is not needed.

Hi,

the change in the patch looks good to me. However, it does not appear to be a networking patch, so I think you have sent it to the wrong place.

With reference to:

$ ./scripts/get_maintainer.pl drivers/gpu/host1x/fence.c
Thierry Reding <[email protected]> (supporter:DRM DRIVERS FOR NVIDIA TEGRA)
David Airlie <[email protected]> (maintainer:DRM DRIVERS)
Daniel Vetter <[email protected]> (maintainer:DRM DRIVERS)
Sumit Semwal <[email protected]> (maintainer:DMA BUFFER SHARING FRAMEWORK)
"Christian König" <[email protected]> (maintainer:DMA BUFFER SHARING FRAMEWORK)
[email protected] (open list:DRM DRIVERS FOR NVIDIA TEGRA)
[email protected] (open list:DRM DRIVERS FOR NVIDIA TEGRA)
[email protected] (open list)
[email protected] (open list:DMA BUFFER SHARING FRAMEWORK)
[email protected] (moderated list:DMA BUFFER SHARING FRAMEWORK)

And https://lore.kernel.org/dri-devel/39c44dce203112a8dfe279e8e2c4ad164e3cf5e5.1666275461.git.robin.murphy@arm.com/

I would suggest that the patch subject should be:

[PATCH] gpu: host1x: Remove redundant null check before kfree

And you should send it:

To: Thierry Reding <[email protected]>
Cc: [email protected], [email protected]

Quoted 21 lines
---
 drivers/gpu/host1x/fence.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/host1x/fence.c +1 -3
index ecab72882192..05b36bfc8b74 100644
@@ -93,8 +93,7 @@ static void host1x_syncpt_fence_release(struct dma_fence *f)
 {
        struct host1x_syncpt_fence *sf = to_host1x_fence(f);
 
-       if (sf->waiter)
-               kfree(sf->waiter);
+       kfree(sf->waiter);
 
        dma_fence_free(f);
 }
--

2.27.0

author
#2 lore raw
Quoted 59 lines · Simon Horman

+ Thierry Reding, linux-tegra, dri-devel

Quoted 7 lines · On Tue, Nov 29, 2022 at 04:43:29PM +0800, [email protected] wrote:

From: Yushan Zhou <[email protected]>

Fix the following coccicheck warning:
./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
NULL check before some freeing functions is not needed.

Hi,

the change in the patch looks good to me. However, it does not appear to be a networking patch, so I think you have sent it to the wrong place.

With reference to:

$ ./scripts/get_maintainer.pl drivers/gpu/host1x/fence.c
Thierry Reding <[email protected]> (supporter:DRM DRIVERS FOR NVIDIA TEGRA)
David Airlie <[email protected]> (maintainer:DRM DRIVERS)
Daniel Vetter <[email protected]> (maintainer:DRM DRIVERS)
Sumit Semwal <[email protected]> (maintainer:DMA BUFFER SHARING FRAMEWORK)
"Christian König" <[email protected]> (maintainer:DMA BUFFER SHARING FRAMEWORK)
[email protected] (open list:DRM DRIVERS FOR NVIDIA TEGRA)
[email protected] (open list:DRM DRIVERS FOR NVIDIA TEGRA)
[email protected] (open list)
[email protected] (open list:DMA BUFFER SHARING FRAMEWORK)
[email protected] (moderated list:DMA BUFFER SHARING FRAMEWORK)

And https://lore.kernel.org/dri-devel/39c44dce203112a8dfe279e8e2c4ad164e3cf5e5.1666275461.git.robin.murphy@arm.com/

I would suggest that the patch subject should be:

[PATCH] gpu: host1x: Remove redundant null check before kfree

And you should send it:

To: Thierry Reding <[email protected]>
Cc: [email protected], [email protected]

Quoted 16 lines
---
 drivers/gpu/host1x/fence.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/host1x/fence.c +1 -2
index ecab72882192..05b36bfc8b74 100644
@@ -93,8 +93,7 @@ static void host1x_syncpt_fence_release(struct dma_fence *f)
 {
        struct host1x_syncpt_fence *sf = to_host1x_fence(f);
 
-       if (sf->waiter)
-               kfree(sf->waiter);
+       kfree(sf->waiter);
 
Quoted 5 lines
Quoted 5 lines
drivers/gpu/host1x/fence.c +0 -1
        dma_fence_free(f);
 }
--

2.27.0

Apologies for the mistake... I'll resend it to the correct place. Thanks for your reminder, anyway.

Best,
Katrin