[PATCH xf86-video-amdgpu 1/5] Remove dead code from probe paths

Michel Dänzer michel at daenzer.net
Thu Oct 29 02:17:30 PDT 2015


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

amdgpu_get_scrninfo allocates the memory pointed to by pAMDGPUEnt just
before it calls amdgpu_open_drm_master, so pAMDGPUEnt->fd is always 0
in the latter.

Also, no need to clear pAMDGPUEnt->fd just before freeing the memory
it's stored in.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_probe.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
index 481271b..28430b2 100644
--- a/src/amdgpu_probe.c
+++ b/src/amdgpu_probe.c
@@ -150,19 +150,9 @@ static int amdgpu_kernel_open_fd(ScrnInfoPtr pScrn, struct pci_device *dev,
 static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn)
 {
 	AMDGPUInfoPtr  info   = AMDGPUPTR(pScrn);
-	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
 	drmSetVersion sv;
 	int err;
 
-	if (pAMDGPUEnt->fd) {
-		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-			   " reusing fd for second head\n");
-
-		info->drmmode.fd = info->dri2.drm_fd = pAMDGPUEnt->fd;
-		pAMDGPUEnt->fd_ref++;
-		return TRUE;
-	}
-
 	info->dri2.drm_fd = amdgpu_kernel_open_fd(pScrn, info->PciInfo, NULL);
 	if (info->dri2.drm_fd == -1)
 		return FALSE;
@@ -266,7 +256,6 @@ static Bool amdgpu_get_scrninfo(int entity_num, void *pci_dev)
 
 error_amdgpu:
 	drmClose(pAMDGPUEnt->fd);
-	pAMDGPUEnt->fd = 0;
 error_fd:
 	free(pPriv->ptr);
 	return FALSE;
@@ -383,7 +372,6 @@ amdgpu_platform_probe(DriverPtr pDriver,
 
 error_amdgpu:
 	drmClose(pAMDGPUEnt->fd);
-	pAMDGPUEnt->fd = 0;
 error_fd:
 	free(pPriv->ptr);
 	return FALSE;
-- 
2.6.1



More information about the xorg-driver-ati mailing list