* [PATCH] gpu: host1x: Remove redundant null checks before kfree
@ 2022-12-01 1:55 ` zys.zljxml
0 siblings, 0 replies; 4+ messages in thread
From: zys.zljxml @ 2022-12-01 1:55 UTC (permalink / raw)
To: thierry.reding, airlied, daniel, sumit.semwal, christian.koenig
Cc: dri-devel, linux-tegra, linux-kernel, linux-media, linaro-mm-sig,
Yushan Zhou
From: Yushan Zhou <katrinzhou@tencent.com>
Fix the following coccicheck warning:
./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
NULL check before some freeing functions is not needed.
Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
---
drivers/gpu/host1x/fence.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c
index ecab72882192..05b36bfc8b74 100644
--- a/drivers/gpu/host1x/fence.c
+++ b/drivers/gpu/host1x/fence.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] gpu: host1x: Remove redundant null checks before kfree
@ 2022-12-01 1:55 ` zys.zljxml
0 siblings, 0 replies; 4+ messages in thread
From: zys.zljxml @ 2022-12-01 1:55 UTC (permalink / raw)
To: thierry.reding, airlied, daniel, sumit.semwal, christian.koenig
Cc: Yushan Zhou, linux-kernel, dri-devel, linaro-mm-sig, linux-tegra,
linux-media
From: Yushan Zhou <katrinzhou@tencent.com>
Fix the following coccicheck warning:
./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
NULL check before some freeing functions is not needed.
Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
---
drivers/gpu/host1x/fence.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c
index ecab72882192..05b36bfc8b74 100644
--- a/drivers/gpu/host1x/fence.c
+++ b/drivers/gpu/host1x/fence.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpu: host1x: Remove redundant null checks before kfree
2022-12-01 1:55 ` zys.zljxml
@ 2022-12-01 7:48 ` Mikko Perttunen
-1 siblings, 0 replies; 4+ messages in thread
From: Mikko Perttunen @ 2022-12-01 7:48 UTC (permalink / raw)
To: zys.zljxml, thierry.reding, airlied, daniel, sumit.semwal,
christian.koenig
Cc: Yushan Zhou, linux-kernel, dri-devel, linaro-mm-sig, linux-tegra,
linux-media
On 12/1/22 03:55, zys.zljxml@gmail.com wrote:
> From: Yushan Zhou <katrinzhou@tencent.com>
>
> Fix the following coccicheck warning:
> ./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
> NULL check before some freeing functions is not needed.
>
> Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
> ---
> drivers/gpu/host1x/fence.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c
> index ecab72882192..05b36bfc8b74 100644
> --- a/drivers/gpu/host1x/fence.c
> +++ b/drivers/gpu/host1x/fence.c
> @@ -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);
> }
I disagree with this coccinelle rule; I think it obfuscates from the
reader the fact that the pointer could be NULL.
Mikko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpu: host1x: Remove redundant null checks before kfree
@ 2022-12-01 7:48 ` Mikko Perttunen
0 siblings, 0 replies; 4+ messages in thread
From: Mikko Perttunen @ 2022-12-01 7:48 UTC (permalink / raw)
To: zys.zljxml, thierry.reding, airlied, daniel, sumit.semwal,
christian.koenig
Cc: dri-devel, linux-tegra, linux-kernel, linux-media, linaro-mm-sig,
Yushan Zhou
On 12/1/22 03:55, zys.zljxml@gmail.com wrote:
> From: Yushan Zhou <katrinzhou@tencent.com>
>
> Fix the following coccicheck warning:
> ./drivers/gpu/host1x/fence.c:97:2-7: WARNING:
> NULL check before some freeing functions is not needed.
>
> Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
> ---
> drivers/gpu/host1x/fence.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c
> index ecab72882192..05b36bfc8b74 100644
> --- a/drivers/gpu/host1x/fence.c
> +++ b/drivers/gpu/host1x/fence.c
> @@ -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);
> }
I disagree with this coccinelle rule; I think it obfuscates from the
reader the fact that the pointer could be NULL.
Mikko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-01 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 1:55 [PATCH] gpu: host1x: Remove redundant null checks before kfree zys.zljxml
2022-12-01 1:55 ` zys.zljxml
2022-12-01 7:48 ` Mikko Perttunen
2022-12-01 7:48 ` Mikko Perttunen
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.