From: Michel Dänzer <[email protected]>

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 <[email protected]>
---
 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

_______________________________________________
xorg-driver-ati mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-driver-ati

Reply via email to