Skip to contentSkip to conversation

drivers:amdgpu: check the return value of amdgpu_bo_kmap

PATCH In review Li Zhong 2 participants 3 messages Sep 22, 2022

Subsystems (3)
lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 drivers:amdgpu: check the return value of amdgpu_bo_kmap

amdgpu_bo_kmap() returns error when fails to map buffer object. Add the error check and propagate the error.

---
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +4 -1
index 1eb4e613b27a..ec055858eb95 100644
@@ -1485,6 +1485,7 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)
 {
 	struct pp_hwmgr *hwmgr = handle;
 	struct amdgpu_device *adev = hwmgr->adev;
+	int err;
 
 	if (!addr || !size)
 		return -EINVAL;
@@ -1492,7 +1493,9 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)
 	*addr = NULL;
 	*size = 0;
 	if (adev->pm.smu_prv_buffer) {
-		amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
+		err = amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
+		if (err)
+			return err;
 		*size = adev->pm.smu_prv_buffer_size;
 	}
 
Signature · 1 line
2.25.1
#1 lore raw

Perhaps you need to update the prefix of patch subject to 'drm/amd/pm: check return value ...'.

With above addressed, it's: Acked-by: Guchun Chen <[email protected]>

Regards,
Guchun

-----Original Message-----
From: Li Zhong <[email protected]>
Sent: Thursday, September 22, 2022 9:27 AM
To: [email protected]; [email protected]
Cc: [email protected]; Powell, Darren <[email protected]>; Chen, Guchun <[email protected]>; Limonciello, Mario <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; [email protected]; Pan, Xinhui <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Li Zhong <[email protected]>
Subject: [PATCH v1] drivers:amdgpu: check the return value of amdgpu_bo_kmap

amdgpu_bo_kmap() returns error when fails to map buffer object. Add the error check and propagate the error.

---
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +4 -1
index 1eb4e613b27a..ec055858eb95 100644
@@ -1485,6 +1485,7 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)  {
 	struct pp_hwmgr *hwmgr = handle;
 	struct amdgpu_device *adev = hwmgr->adev;
+	int err;
 
 	if (!addr || !size)
 		return -EINVAL;
@@ -1492,7 +1493,9 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)
 	*addr = NULL;
 	*size = 0;
 	if (adev->pm.smu_prv_buffer) {
-		amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
+		err = amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
+		if (err)
+			return err;
 		*size = adev->pm.smu_prv_buffer_size;
 	}
 

--
2.25.1

author
#2 lore raw
Quoted 45 lines · Guchun

Perhaps you need to update the prefix of patch subject to 'drm/amd/pm: check return value ...'.

With above addressed, it's: Acked-by: Guchun Chen <[email protected]>

Regards,
Guchun

-----Original Message-----
From: Li Zhong <[email protected]>
Sent: Thursday, September 22, 2022 9:27 AM
To: [email protected]; [email protected]
Cc: [email protected]; Powell, Darren <[email protected]>; Chen, Guchun <[email protected]>; Limonciello, Mario <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; [email protected]; Pan, Xinhui <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Li Zhong <[email protected]>
Subject: [PATCH v1] drivers:amdgpu: check the return value of amdgpu_bo_kmap

amdgpu_bo_kmap() returns error when fails to map buffer object. Add the error check and propagate the error.

---
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +4 -2
index 1eb4e613b27a..ec055858eb95 100644
@@ -1485,6 +1485,7 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)  {
        struct pp_hwmgr *hwmgr = handle;
        struct amdgpu_device *adev = hwmgr->adev;
+       int err;
 
        if (!addr || !size)
                return -EINVAL;
@@ -1492,7 +1493,9 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)
        *addr = NULL;
        *size = 0;
        if (adev->pm.smu_prv_buffer) {
-               amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
+               err = amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
+               if (err)
+                       return err;
                *size = adev->pm.smu_prv_buffer_size;
        }
 
--
Quoted 2 lines

2.25.1

Thanks for your reply! It's updated in the v2 patch.