From: "Yadav, Arvind" <arvyadav@amd.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Arunpravin Paneer Selvam" <Arunpravin.PaneerSelvam@amd.com>,
"Arvind Yadav" <Arvind.Yadav@amd.com>,
"Shashank Sharma" <shashank.sharma@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Clean up error handling in amdgpu_userq_fence_driver_alloc()
Date: Mon, 14 Apr 2025 10:08:50 +0530 [thread overview]
Message-ID: <3d8df435-a248-4f38-7a2a-b0f2ec908ae0@amd.com> (raw)
In-Reply-To: <b9adf038b3ccf058c49e7e74e1998bc2216e0678.1744468610.git.dan.carpenter@linaro.org>
Reviewed-by:Arvind Yadav <arvind.yadav@amd.com>
On 4/12/2025 8:09 PM, Dan Carpenter wrote:
> 1) Checkpatch complains if we print an error message for kzalloc()
> failure. The kzalloc() failure already has it's own error messages
> built in. Also this allocation is small enough that it is guaranteed
> to succeed.
> 2) Return directly instead of doing a goto free_fence_drv. The
> "fence_drv" is already NULL so no cleanup is necessary.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: New patch
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> index b012fece91e8..86eab5461162 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -75,11 +75,8 @@ int amdgpu_userq_fence_driver_alloc(struct amdgpu_device *adev,
> int r;
>
> fence_drv = kzalloc(sizeof(*fence_drv), GFP_KERNEL);
> - if (!fence_drv) {
> - DRM_ERROR("Failed to allocate memory for fence driver\n");
> - r = -ENOMEM;
> - goto free_fence_drv;
> - }
> + if (!fence_drv)
> + return -ENOMEM;
>
> /* Acquire seq64 memory */
> r = amdgpu_seq64_alloc(adev, &fence_drv->va, &fence_drv->gpu_addr,
next prev parent reply other threads:[~2025-04-14 4:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-12 14:39 [PATCH v2 0/2] drm/amdgpu: Fixes to amdgpu_userq_fence_driver_alloc() Dan Carpenter
2025-04-12 14:39 ` [PATCH v2 1/2] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc() Dan Carpenter
2025-04-14 4:38 ` Yadav, Arvind
2025-04-12 14:39 ` [PATCH v2 2/2] drm/amdgpu: Clean up error handling " Dan Carpenter
2025-04-14 4:38 ` Yadav, Arvind [this message]
2025-04-14 16:24 ` Alex Deucher
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=3d8df435-a248-4f38-7a2a-b0f2ec908ae0@amd.com \
--to=arvyadav@amd.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=Arvind.Yadav@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dan.carpenter@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shashank.sharma@amd.com \
--cc=simona@ffwll.ch \
/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®