if (psBCInfo->psFuncTable)
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
- sizeof(struct PVRSRV_BC_SRV2BUFFER_KMJTABLE *),
- psBCInfo->psFuncTable, NULL);
+ sizeof(*psBCInfo->psFuncTable), psBCInfo->psFuncTable,
+ NULL);
- OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
- sizeof(struct PVRSRV_BUFFERCLASS_INFO), psBCInfo, NULL);
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psBCInfo), psBCInfo, NULL);
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
{
struct PVRSRV_DISPLAYCLASS_INFO *psDCInfo;
struct PVRSRV_DISPLAYCLASS_PERCONTEXT_INFO *psDCPerContextInfo;
+ struct PVRSRV_DC_SRV2DISP_KMJTABLE *jtbl;
struct PVRSRV_DEVICE_NODE *psDeviceNode;
struct SYS_DATA *psSysData;
+ enum PVRSRV_ERROR eError;
if (!phDeviceKM || !hDevCookie) {
PVR_DPF(PVR_DBG_ERROR,
OSMemSet(psDCPerContextInfo, 0, sizeof(*psDCPerContextInfo));
if (psDCInfo->ui32RefCount++ == 0) {
- enum PVRSRV_ERROR eError;
- struct PVRSRV_DC_SRV2DISP_KMJTABLE *jtbl;
-
psDeviceNode = (struct PVRSRV_DEVICE_NODE *)hDevCookie;
jtbl = psDCInfo->psFuncTable;
if (!try_module_get(jtbl->owner)) {
PVR_DPF(PVR_DBG_ERROR, "%s: can't get DC module");
- return PVRSRV_ERROR_INVALID_DEVICE;
+ eError = PVRSRV_ERROR_INVALID_DEVICE;
+
+ goto err1;
}
psDCInfo->hDevMemContext =
if (eError != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR,
"PVRSRVOpenDCDeviceKM: Failed sync info alloc");
- psDCInfo->ui32RefCount--;
- module_put(jtbl->owner);
- return eError;
+
+ goto err2;
}
eError = jtbl->pfnOpenDCDevice(ui32DeviceID,
if (eError != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenDCDeviceKM: "
"Failed to open external DC device");
- psDCInfo->ui32RefCount--;
- module_put(jtbl->owner);
- PVRSRVFreeSyncInfoKM(psDCInfo->sSystemBuffer.
- sDeviceClassBuffer.psKernelSyncInfo);
- return eError;
+ goto err3;
}
}
*phDeviceKM = (void *) psDCPerContextInfo;
return PVRSRV_OK;
+err3:
+ PVRSRVFreeSyncInfoKM(psDCInfo->sSystemBuffer.
+ sDeviceClassBuffer.psKernelSyncInfo);
+err2:
+ module_put(jtbl->owner);
+ psDCInfo->ui32RefCount--;
+err1:
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psDCPerContextInfo),
+ psDCPerContextInfo, NULL);
+
+ return eError;
}
enum PVRSRV_ERROR PVRSRVEnumDCFormatsKM(void *hDeviceKM,
}
LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) {
- if (PVRSRVProcessQueues(KERNEL_ID, IMG_FALSE) !=
+ if (PVRSRVProcessQueues(IMG_FALSE) !=
PVRSRV_ERROR_PROCESSING_BLOCKED) {
goto ProcessedQueues;
}
}
LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) {
- if (PVRSRVProcessQueues(KERNEL_ID, IMG_FALSE) !=
+ if (PVRSRVProcessQueues(IMG_FALSE) !=
PVRSRV_ERROR_PROCESSING_BLOCKED) {
goto ProcessedQueues;
}
struct PVRSRV_BUFFERCLASS_INFO *psBCInfo;
struct PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *psBCPerContextInfo;
struct PVRSRV_DEVICE_NODE *psDeviceNode;
+ struct BUFFER_INFO sBufferInfo;
struct SYS_DATA *psSysData;
u32 i;
enum PVRSRV_ERROR eError;
OSMemSet(psBCPerContextInfo, 0, sizeof(*psBCPerContextInfo));
if (psBCInfo->ui32RefCount++ == 0) {
- struct BUFFER_INFO sBufferInfo;
-
psDeviceNode = (struct PVRSRV_DEVICE_NODE *)hDevCookie;
psBCInfo->hDevMemContext =
if (eError != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
"Failed to open external BC device");
- return eError;
+ goto err1;
}
eError =
if (eError != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR,
"PVRSRVOpenBCDeviceKM : Failed to get BC Info");
- return eError;
+ goto err2;
}
psBCInfo->ui32BufferCount = sBufferInfo.ui32BufferCount;
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) *
if (eError != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
"Failed sync info alloc");
- goto ErrorExit;
+ goto err3;
}
eError = psBCInfo->psFuncTable->pfnGetBCBuffer(
if (eError != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR, "PVRSRVOpenBCDeviceKM: "
"Failed to get BC buffers");
- goto ErrorExit;
+ goto err3;
}
psBCInfo->psBuffer[i].sDeviceClassBuffer.
return PVRSRV_OK;
-ErrorExit:
-
+err3:
for (i = 0; i < psBCInfo->ui32BufferCount; i++) {
if (psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo) {
PVRSRVFreeSyncInfoKM(psBCInfo->psBuffer[i].
psKernelSyncInfo);
}
}
-
- if (psBCInfo->psBuffer) {
- OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
- sizeof(struct PVRSRV_BC_BUFFER), psBCInfo->psBuffer,
- NULL);
- }
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
+ sizeof(struct PVRSRV_BC_BUFFER) * sBufferInfo.ui32BufferCount,
+ psBCInfo->psBuffer, NULL);
+err2:
+ psBCInfo->psFuncTable->pfnCloseBCDevice(psBCInfo->hExtDevice);
+err1:
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(*psBCPerContextInfo),
+ psBCPerContextInfo, NULL);
+ psBCInfo->ui32RefCount--;
return eError;
}