From: Mikko Perttunen <cyndis@kapsi.fi>
To: zys.zljxml@gmail.com, thierry.reding@gmail.com,
airlied@gmail.com, daniel@ffwll.ch, sumit.semwal@linaro.org,
christian.koenig@amd.com
Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org,
Yushan Zhou <katrinzhou@tencent.com>
Subject: Re: [PATCH] gpu: host1x: Remove redundant null checks before kfree
Date: Thu, 1 Dec 2022 09:48:20 +0200 [thread overview]
Message-ID: <e46598e5-d680-5ae3-3e4a-ec6e5be5090b@kapsi.fi> (raw)
In-Reply-To: <20221201015522.38163-1-zys.zljxml@gmail.com>
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
prev parent reply other threads:[~2022-12-01 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 1:55 [PATCH] gpu: host1x: Remove redundant null checks before kfree zys.zljxml
2022-12-01 7:48 ` Mikko Perttunen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e46598e5-d680-5ae3-3e4a-ec6e5be5090b@kapsi.fi \
--to=cyndis@kapsi.fi \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=katrinzhou@tencent.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=thierry.reding@gmail.com \
--cc=zys.zljxml@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).