[PATCH xf86-video-amdgpu 1/3] Don't use AMDGPUEntPriv in AMDGPUFreeRec

Michel Dänzer michel at daenzer.net
Mon Nov 2 01:30:39 PST 2015


From: Michel Dänzer <michel.daenzer at amd.com>

It crashes if info == NULL.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_kms.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 5e17525..41f01b3 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -107,7 +107,8 @@ static Bool AMDGPUGetRec(ScrnInfoPtr pScrn)
 /* Free our private AMDGPUInfoRec */
 static void AMDGPUFreeRec(ScrnInfoPtr pScrn)
 {
-	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
+	DevUnion *pPriv;
+	AMDGPUEntPtr pAMDGPUEnt;
 	AMDGPUInfoPtr info;
 
 	if (!pScrn)
@@ -117,6 +118,9 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)
 	if (info && info->fbcon_pixmap)
 		pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap);
 
+	pPriv = xf86GetEntityPrivate(xf86GetEntityInfo(pScrn->entityList[pScrn->numEntities - 1])->index,
+				     gAMDGPUEntityIndex);
+	pAMDGPUEnt = pPriv->ptr;
 	if (pAMDGPUEnt->fd > 0) {
 		DevUnion *pPriv;
 		AMDGPUEntPtr pAMDGPUEnt;
-- 
2.6.2



More information about the xorg-driver-ati mailing list