kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] drm/amd/amdgpu: Fix missing error return on kzalloc failure
@ 2025-09-02 12:40 Colin Ian King
  2025-09-02 14:36 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-09-02 12:40 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Hawking Zhang, Lijo Lazar, Sunil Khatri, John Clements, amd-gfx,
	dri-devel
  Cc: kernel-janitors, linux-kernel

Currently the kzalloc failure check just sets reports the failure
and sets the variable ret to -ENOMEM, which is not checked later
for this specific error. Fix this by just returning -ENOMEM rather
than setting ret.

Fixes: 4fb930715468 ("drm/amd/amdgpu: remove redundant host to psp cmd buf allocations")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 1d6e1d5de8fa..3696f48c233b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -448,7 +448,7 @@ static int psp_sw_init(struct amdgpu_ip_block *ip_block)
 	psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
 	if (!psp->cmd) {
 		dev_err(adev->dev, "Failed to allocate memory to command buffer!\n");
-		ret = -ENOMEM;
+		return -ENOMEM;
 	}
 
 	adev->psp.xgmi_context.supports_extended_data =
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] drm/amd/amdgpu: Fix missing error return on kzalloc failure
  2025-09-02 12:40 [PATCH][next] drm/amd/amdgpu: Fix missing error return on kzalloc failure Colin Ian King
@ 2025-09-02 14:36 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2025-09-02 14:36 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Hawking Zhang, Lijo Lazar, Sunil Khatri, John Clements, amd-gfx,
	dri-devel, kernel-janitors, linux-kernel

Applied.  Thanks!

Alex

On Tue, Sep 2, 2025 at 8:49 AM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> Currently the kzalloc failure check just sets reports the failure
> and sets the variable ret to -ENOMEM, which is not checked later
> for this specific error. Fix this by just returning -ENOMEM rather
> than setting ret.
>
> Fixes: 4fb930715468 ("drm/amd/amdgpu: remove redundant host to psp cmd buf allocations")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 1d6e1d5de8fa..3696f48c233b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -448,7 +448,7 @@ static int psp_sw_init(struct amdgpu_ip_block *ip_block)
>         psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
>         if (!psp->cmd) {
>                 dev_err(adev->dev, "Failed to allocate memory to command buffer!\n");
> -               ret = -ENOMEM;
> +               return -ENOMEM;
>         }
>
>         adev->psp.xgmi_context.supports_extended_data =
> --
> 2.51.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-02 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 12:40 [PATCH][next] drm/amd/amdgpu: Fix missing error return on kzalloc failure Colin Ian King
2025-09-02 14:36 ` Alex Deucher

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).