gpu: pvr: refactor error path in PVRSRVOpenBCDeviceKM
authorImre Deak <imre.deak@nokia.com>
Wed, 30 Mar 2011 12:13:08 +0000 (15:13 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:04 +0000 (21:43 +0300)
Needed by the next 2 patches fixing the error path.

No functional change.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
pvr/deviceclass.c

index 88dd6e8..826f2a7 100644 (file)
@@ -1364,7 +1364,7 @@ FoundDevice:
                if (eError != PVRSRV_OK) {
                        PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
                                        "Failed to open external BC device");
-                       return eError;
+                       goto err1;
                }
 
                eError =
@@ -1373,7 +1373,7 @@ FoundDevice:
                if (eError != PVRSRV_OK) {
                        PVR_DPF(PVR_DBG_ERROR,
                                "PVRSRVOpenBCDeviceKM : Failed to get BC Info");
-                       return eError;
+                       goto err2;
                }
 
                psBCInfo->ui32BufferCount = sBufferInfo.ui32BufferCount;
@@ -1386,7 +1386,7 @@ FoundDevice:
                if (eError != PVRSRV_OK) {
                        PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
                                        "Failed to allocate BC buffers");
-                       return eError;
+                       goto err2;
                }
                OSMemSet(psBCInfo->psBuffer, 0,
                         sizeof(struct PVRSRV_BC_BUFFER) *
@@ -1401,7 +1401,7 @@ FoundDevice:
                        if (eError != PVRSRV_OK) {
                                PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
                                                "Failed sync info alloc");
-                               goto ErrorExit;
+                               goto err3;
                        }
 
                        eError = psBCInfo->psFuncTable->pfnGetBCBuffer(
@@ -1414,7 +1414,7 @@ FoundDevice:
                        if (eError != PVRSRV_OK) {
                                PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
                                                "Failed to get BC buffers");
-                               goto ErrorExit;
+                               goto err3;
                        }
 
                        psBCInfo->psBuffer[i].sDeviceClassBuffer.
@@ -1437,8 +1437,7 @@ FoundDevice:
 
        return PVRSRV_OK;
 
-ErrorExit:
-
+err3:
        for (i = 0; i < psBCInfo->ui32BufferCount; i++) {
                if (psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo) {
                        PVRSRVFreeSyncInfoKM(psBCInfo->psBuffer[i].
@@ -1452,7 +1451,8 @@ ErrorExit:
                          sizeof(struct PVRSRV_BC_BUFFER), psBCInfo->psBuffer,
                          NULL);
        }
-
+err2:
+err1:
        return eError;
 }