Skip to contentSkip to conversation

DSPBRIDGE: unrelated fixes

PATCH Applied Omar Ramirez Luna 1 participant 5 messages Feb 18, 2010 – Feb 24, 2010

lore
Share & tools
lore
#0 lore raw

cover DSPBRIDGE: unrelated fixes

A couple of unrelated fixes.

Omar Ramirez Luna (2):
DSPBRIDGE: logic error fix for SleepDSP timeout value
DSPBRIDGE: check pointer before dereference

 drivers/dsp/bridge/pmgr/msg.c           |   16 ++++++++--------
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
#1 lore raw

PATCH 1/2 DSPBRIDGE: logic error fix for SleepDSP timeout value

When leaving the loop waiting for the dsp to transition from its power state, timeout value will be negative, therefore a print for "timeout waiting for the dsp" won't be displayed, as the condition to check for is !timeout.

---
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +1 -1
index 084f406..96b942b 100644
@@ -239,7 +239,7 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd,
 			&pwrState);
 
 	/* Wait for DSP to move into target power state */
-	while ((pwrState != targetPwrState) && timeout--) {
+	while ((pwrState != targetPwrState) && --timeout) {
 		if (msleep_interruptible(10)) {
 			pr_err("Waiting for DSP to Suspend interrupted\n");
 			return DSP_EFAIL;
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH 2/2 DSPBRIDGE: check pointer before dereference

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

---
 drivers/dsp/bridge/pmgr/msg.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/dsp/bridge/pmgr/msg.c +8 -8
index 5cfeb5b..9e4b202 100644
@@ -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);
+	}
 }
 
 /*
Signature · 1 line
1.6.2.4
#3 lore raw

Re: [PATCH 2/2] DSPBRIDGE: check pointer before dereference

Quoted 8 lines · Omar

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

---
  drivers/dsp/bridge/pmgr/msg.c |   16 ++++++++--------
  1 files changed, 8 insertions(+), 8 deletions(-)

Rebased and pushed to dspbridge

- omar

author Applied
#4 lore raw

Re: [PATCH 1/2] DSPBRIDGE: logic error fix for SleepDSP timeout value

In reply to Omar Ramirez Luna
Quoted 11 lines · Omar

When leaving the loop waiting for the dsp to transition from its power state, timeout value will be negative, therefore a print for "timeout waiting for the dsp" won't be displayed, as the condition to check for is !timeout.

---
  drivers/dsp/bridge/wmd/tiomap3430_pwr.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

Pushed to dspbridge

- omar