]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/amdgpu: Fix missing error return on kzalloc failure
authorColin Ian King <colin.i.king@gmail.com>
Tue, 2 Sep 2025 12:40:50 +0000 (13:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:54:23 +0000 (18:54 +0200)
[ Upstream commit 467e00b30dfe75c4cfc2197ceef1fddca06adc25 ]

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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 1ee9d1a0962c13ba5ab7e47d33a80e3b8dc4b52e)
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index df38eb9604ec355db7641411e53fb49cb9ac6654..0bc21106d9e8710941f1b8db28ad3dbc94717ce3 100644 (file)
@@ -373,7 +373,7 @@ static int psp_sw_init(void *handle)
        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;
        }
 
        if (amdgpu_sriov_vf(adev))