Change the check for valid handle to detect a possible
error, and now use it before dereferencing the pointer.

Signed-off-by: Omar Ramirez Luna <[email protected]>
---
 drivers/dsp/bridge/pmgr/msg.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/msg.c b/drivers/dsp/bridge/pmgr/msg.c
index 5cfeb5b..9e4b202 100644
--- a/drivers/dsp/bridge/pmgr/msg.c
+++ b/drivers/dsp/bridge/pmgr/msg.c
@@ -104,19 +104,19 @@ void MSG_Delete(struct MSG_MGR *hMsgMgr)
        struct WMD_DRV_INTERFACE *pIntfFxns;
 
        DBC_Require(cRefs > 0);
-       DBC_Require(MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE));
 
        GT_1trace(MSG_debugMask, GT_ENTER, "MSG_Delete: hMsgMgr: 0x%x\n",
                 hMsgMgr);
 
-       pIntfFxns = pMsgMgr->pIntfFxns;
+       if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE)) {
+               pIntfFxns = pMsgMgr->pIntfFxns;
 
-       /* Let WMD message module destroy the MSG_MGR: */
-       (*pIntfFxns->pfnMsgDelete)(hMsgMgr);
-
-       if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
-               GT_1trace(MSG_debugMask, GT_7CLASS, "MSG_Delete: Error hMsgMgr "
-                                       "Valid Handle: 0x%x\n", hMsgMgr);
+               /* Let WMD message module destroy the MSG_MGR: */
+               (*pIntfFxns->pfnMsgDelete)(hMsgMgr);
+       } else {
+               GT_1trace(MSG_debugMask, GT_7CLASS, "MSG_Delete: Error hMsgMgr"
+                                       "invalid Handle: 0x%x\n", hMsgMgr);
+       }
 }
 
 /*
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to