[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210307092010.23117-1-baijiaju1990@gmail.com>
Date: Sun, 7 Mar 2021 01:20:10 -0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: alexander.deucher@....com, christian.koenig@....com,
airlied@...ux.ie, daniel@...ll.ch, yebin10@...wei.com,
luben.tuikov@....com, Likun.Gao@....com, Prike.Liang@....com,
avg@...eBSD.org
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] gpu: drm: amd: amdgpu: fix error return code of amdgpu_acpi_init()
Add error return code in error hanlding code of amdgpu_acpi_init().
Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 8155c54392c8..156f30d5a2c0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -788,12 +788,15 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
/* Probe for ATIF, and initialize it if found */
atif_handle = amdgpu_atif_probe_handle(handle);
- if (!atif_handle)
+ if (!atif_handle) {
+ ret = -EINVAL;
goto out;
+ }
atif = kzalloc(sizeof(*atif), GFP_KERNEL);
if (!atif) {
DRM_WARN("Not enough memory to initialize ATIF\n");
+ ret = -ENOMEM;
goto out;
}
atif->handle = atif_handle;
@@ -803,6 +806,7 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
if (ret) {
DRM_DEBUG_DRIVER("Call to ATIF verify_interface failed: %d\n", ret);
kfree(atif);
+ ret = -EINVAL;
goto out;
}
adev->atif = atif;
--
2.17.1
Powered by blists - more mailing lists