[PATCH xf86-video-amdgpu 10/19] Remove unneeded xf86GetEntityInfo() call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Emil Velikov <emil.velikov@xxxxxxxxxxxxx>

We only use ent->index, which is the same as the argument fed into the
function.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Note: I'm not 100% sure if the X API guarantees that, yet it seems to be
the case for over 3 years.
---
 src/amdgpu_probe.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
index 8842868..537d44c 100644
--- a/src/amdgpu_probe.c
+++ b/src/amdgpu_probe.c
@@ -198,7 +198,6 @@ static Bool
 amdgpu_probe(ScrnInfoPtr pScrn, int entity_num,
 	     struct pci_device *pci_dev, struct xf86_platform_device *dev)
 {
-	EntityInfoPtr pEnt = NULL;
 	DevUnion *pPriv;
 	AMDGPUEntPtr pAMDGPUEnt;
 
@@ -218,8 +217,6 @@ amdgpu_probe(ScrnInfoPtr pScrn, int entity_num,
 	pScrn->FreeScreen = AMDGPUFreeScreen_KMS;
 	pScrn->ValidMode = AMDGPUValidMode;
 
-	pEnt = xf86GetEntityInfo(entity_num);
-
 	/* Create a AMDGPUEntity for all chips, even with old single head
 	 * Radeon, need to use pAMDGPUEnt for new monitor detection routines.
 	 */
@@ -228,7 +225,7 @@ amdgpu_probe(ScrnInfoPtr pScrn, int entity_num,
 	if (gAMDGPUEntityIndex == -1)
 		gAMDGPUEntityIndex = xf86AllocateEntityPrivateIndex();
 
-	pPriv = xf86GetEntityPrivate(pEnt->index, gAMDGPUEntityIndex);
+	pPriv = xf86GetEntityPrivate(entity_num, gAMDGPUEntityIndex);
 
 	if (!pPriv->ptr) {
 		pPriv->ptr = xnfcalloc(sizeof(AMDGPUEntRec), 1);
@@ -239,16 +236,13 @@ amdgpu_probe(ScrnInfoPtr pScrn, int entity_num,
 	pAMDGPUEnt = pPriv->ptr;
 	pAMDGPUEnt->fd_ref++;
 
-	xf86SetEntityInstanceForScreen(pScrn, pEnt->index,
-				       xf86GetNumEntityInstances(pEnt->
-								 index)
+	xf86SetEntityInstanceForScreen(pScrn, entity_num,
+				       xf86GetNumEntityInstances(entity_num)
 				       - 1);
-	free(pEnt);
 
 	return TRUE;
 
 error:
-	free(pEnt);
 	return FALSE;
 }
 
-- 
2.16.0



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux