From: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx> Theoretically list could be deleted before we go into the for loop. Additionally we could delete list immediately if it becomes empty. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx> --- drivers/dsp/bridge/rmgr/drv.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index d21071c..9f726a6 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -1545,18 +1545,23 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct DRV_OBJECT *hDrvObject) for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension(); pszdevNode != NULL; pszdevNode = (struct DRV_EXT *) DRV_GetNextDevExtension((u32)pszdevNode)) { + if (!pDRVObject->devNodeString) + /* List already deleted */ + break; + if ((u32)pszdevNode == dwContext) { /* Found it */ /* Delete from the Driver object list */ LST_RemoveElem(pDRVObject->devNodeString, - (struct LST_ELEM *)pszdevNode); + (struct LST_ELEM *) pszdevNode); MEM_Free((void *) pszdevNode); - break; } + /* Delete the List if it is empty */ if (LST_IsEmpty(pDRVObject->devNodeString)) { LST_Delete(pDRVObject->devNodeString); pDRVObject->devNodeString = NULL; + break; } } return status; -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html