diff mbox

[5/5v3] DSPBRIDGE: Avoid errors if stream id is zero

Message ID 1271804580-17072-5-git-send-email-ernesto@ti.com (mailing list archive)
State Under Review, archived
Delegated to:
Headers show

Commit Message

Ramos Falcon, Ernesto April 20, 2010, 11:03 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 7c52c6b..4a4e133 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -1498,7 +1498,7 @@  inline void find_strm_handle(struct strm_res_object **strmres,
 {
 	rcu_read_lock();
 	*strmres = idr_find(((struct process_context *)pr_ctxt)->strm_idp,
-							(int)hstream);
+							(int)hstream - 1);
 	rcu_read_unlock();
 	return;
 }
@@ -1691,6 +1691,7 @@  u32 strmwrap_open(union Trapped_Args *args, void *pr_ctxt)
 	struct strm_res_object *strm_res_obj;
 	struct dsp_streamattrin strm_attr_in;
 	struct node_res_object *node_res;
+	int strmid;
 
 	find_node_handle(&node_res, pr_ctxt, args->args_strm_open.hnode);
 
@@ -1712,7 +1713,10 @@  u32 strmwrap_open(union Trapped_Args *args, void *pr_ctxt)
 			   args->args_strm_open.direction,
 			   args->args_strm_open.index, &attr, &strm_res_obj,
 			   pr_ctxt);
-	CP_TO_USR(args->args_strm_open.ph_stream, &strm_res_obj->id, status, 1);
+	if (DSP_SUCCEEDED(status)) {
+		strmid = strm_res_obj->id + 1;
+		CP_TO_USR(args->args_strm_open.ph_stream, &strmid, status, 1);
+	}
 	return status;
 }