DSP is not supposed to return bad opp_indices which are not part of
the opp table we created for it. If it does, throw an error, and
refuse to switch the OPP.

Ref: discussion: http://marc.info/?t=126395196000002&r=1&w=2
Depends on: http://marc.info/?l=linux-omap&m=126402596424801&w=2

Cc: Ameya Palande <ameya.pala...@nokia.com>
Cc: Deepak Chitriki <deepak.chitr...@ti.com>
Cc: Felipe Contreras <felipe.contre...@nokia.com>
Cc: Hiroshi Doyu <hiroshi.d...@nokia.com>
Cc: Omar Ramirez Luna <omar.rami...@ti.com>

Signed-off-by: Nishanth Menon <n...@ti.com>
---
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c 
b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
index 5dfbef8..a13e035 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
@@ -73,6 +73,12 @@ DSP_STATUS handle_constraints_set(struct WMD_DEV_CONTEXT 
*pDevContext,
        /* pick up the opp index */
        opp_idx = *(((u32 *)(pArgs)) + 1);
 
+       /* Sanity check to ensure things are fine */
+       if (!opp_idx || (opp_idx > pdata->dsp_num_speeds)) {
+               pr_err("%s: DSP requested for an invalid OPP %d Vs %d->%d!\n",
+                       __func__, opp_idx, 1, pdata->dsp_num_speeds);
+               return DSP_EINVALIDARG;
+       }
        /* Read the target value requested by DSP  */
        DBG_Trace(DBG_LEVEL7, "handle_constraints_set:"
                "opp requested = 0x%x\n", opp_idx);
-- 
1.6.3.3

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

Reply via email to