From: "Christian König" <christian.koenig@amd.com>
To: Liao Yuanhong <liaoyuanhong@vivo.com>,
Alex Deucher <alexander.deucher@amd.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
Lijo Lazar <lijo.lazar@amd.com>,
"open list:RADEON and AMDGPU DRM DRIVERS"
<amd-gfx@lists.freedesktop.org>,
"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu/fence: Remove redundant 0 value initialization
Date: Tue, 19 Aug 2025 10:41:37 +0200 [thread overview]
Message-ID: <00e7ce33-cc0a-4249-ac18-081ab9ead243@amd.com> (raw)
In-Reply-To: <20250819082524.526572-1-liaoyuanhong@vivo.com>
On 19.08.25 10:25, Liao Yuanhong wrote:
> The amdgpu_fence struct is already zeroed by kzalloc(). It's redundant to
> initialize am_fence->context to 0.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
If you want a challenge what we would really use is a scan of all the structures defined in drivers/gpu/drm/amd/amdgpu/*.[ch] for unused fields.
The UAPI and BIOS/HW header files are full of padding fields, but there shouldn't be any in the driver core defines and we sometimes forget to remove fields from structures when they are not used any more.
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index bcb74286a78a..fd8cca241da6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -120,7 +120,6 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f,
> am_fence = kzalloc(sizeof(*am_fence), GFP_KERNEL);
> if (!am_fence)
> return -ENOMEM;
> - am_fence->context = 0;
> } else {
> am_fence = af;
> }
next prev parent reply other threads:[~2025-08-19 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 8:25 Liao Yuanhong
2025-08-19 8:41 ` Christian König [this message]
2025-08-19 11:34 ` Liao Yuanhong
2025-08-19 13:10 ` Alex Deucher
2025-08-19 8:55 ` Markus Elfring
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=00e7ce33-cc0a-4249-ac18-081ab9ead243@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=liaoyuanhong@vivo.com \
--cc=lijo.lazar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=simona@ffwll.ch \
--cc=srinivasan.shanmugam@amd.com \
--cc=tglx@linutronix.de \
/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®