[PATCH 1/1] drm/amdgpu: Fix error handling in amdgpu_ras_recovery_init

Zhang, Hawking Hawking.Zhang at amd.com
Fri Oct 4 07:41:01 UTC 2019


Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>

Regards,
Hawking
-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Kuehling, Felix
Sent: 2019年10月4日 6:01
To: amd-gfx at lists.freedesktop.org; Grodzovsky, Andrey <Andrey.Grodzovsky at amd.com>
Cc: Cox, Philip <Philip.Cox at amd.com>
Subject: [PATCH 1/1] drm/amdgpu: Fix error handling in amdgpu_ras_recovery_init

Don't set a struct pointer to NULL before freeing its members. It's hard to see what's happening due to a local pointer-to-pointer data aliasing con->eh_data.

Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 486568ded6d6..0e2ee5869b5f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1542,10 +1542,10 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev)
 release:
 	amdgpu_ras_release_bad_pages(adev);
 free:
-	con->eh_data = NULL;
 	kfree((*data)->bps);
 	kfree((*data)->bps_bo);
 	kfree(*data);
+	con->eh_data = NULL;
 out:
 	DRM_WARN("Failed to initialize ras recovery!\n");
 
--
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list