diff mbox

dspbridge: Check pointer before usage

Message ID 1251792681-14472-1-git-send-email-andy.shevchenko@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Andy Shevchenko Sept. 1, 2009, 8:11 a.m. UTC
From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Check list pointer at every itteration because it could be deleted before we go
into the for loop.

Reworked version of the previous attempts.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 drivers/dsp/bridge/rmgr/drv.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index d21071c..7e41669 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -1543,8 +1543,9 @@  DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct DRV_OBJECT *hDrvObject)
 	 *  The following will over write the status.
 	 */
 	for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension();
-	    pszdevNode != NULL; pszdevNode = (struct DRV_EXT *)
-	    DRV_GetNextDevExtension((u32)pszdevNode)) {
+	    pszdevNode != NULL && pDRVObject->devNodeString != NULL;
+	    pszdevNode = (struct DRV_EXT *)
+			  DRV_GetNextDevExtension((u32) pszdevNode)) {
 		if ((u32)pszdevNode == dwContext) {
 			/* Found it */
 			/* Delete from the Driver object list */