From: Rodrigo Siqueira Jordao <Rodrigo.Siqueira@amd.com>
To: "Deepak R Varma" <drv@mailo.com>,
"Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: Re: [PATCH] drm/amd/display: No need for Null pointer check before kfree
Date: Tue, 10 Jan 2023 10:54:58 -0500 [thread overview]
Message-ID: <7a16f713-b8ca-d46c-a18d-d48e6938be16@amd.com> (raw)
In-Reply-To: <Y6s7989gmBZldV/S@qemulion>
On 12/27/22 13:39, Deepak R Varma wrote:
> kfree() & vfree() internally performs NULL check on the pointer handed
> to it and take no action if it indeed is NULL. Hence there is no need
> for a pre-check of the memory pointer before handing it to
> kfree()/vfree().
>
> Issue reported by ifnullfree.cocci Coccinelle semantic patch script.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c | 3 +--
> drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c
> index 3ce0ee0d012f..694a9d3d92ae 100644
> --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c
> +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c
> @@ -577,8 +577,7 @@ void dcn3_clk_mgr_construct(
>
> void dcn3_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
> {
> - if (clk_mgr->base.bw_params)
> - kfree(clk_mgr->base.bw_params);
> + kfree(clk_mgr->base.bw_params);
>
> if (clk_mgr->wm_range_table)
> dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
> diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c
> index 200fcec19186..ba9814f88f48 100644
> --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c
> +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c
> @@ -783,8 +783,7 @@ void dcn32_clk_mgr_construct(
>
> void dcn32_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
> {
> - if (clk_mgr->base.bw_params)
> - kfree(clk_mgr->base.bw_params);
> + kfree(clk_mgr->base.bw_params);
>
> if (clk_mgr->wm_range_table)
> dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
> --
> 2.34.1
>
>
>
Hi,
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
And applied to amd-staging-drm-next.
Thanks
Siqueira
prev parent reply other threads:[~2023-01-10 15:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 18:39 Deepak R Varma
2023-01-07 20:29 ` Deepak R Varma
2023-01-10 15:54 ` Rodrigo Siqueira Jordao [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=7a16f713-b8ca-d46c-a18d-d48e6938be16@amd.com \
--to=rodrigo.siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=drv@mailo.com \
--cc=harry.wentland@amd.com \
--cc=kumarpraveen@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ssengar@microsoft.com \
--cc=sunpeng.li@amd.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
all inboxes | Powered by JetHome®