Commit cef72512 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer

Remove dead code from probe paths

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.
Reviewed-by: Jammy Zhou's avatarJammy Zhou <Jammy.Zhou@amd.com>
parent 3b0a3c89
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment