[PATCHv2 14/18] DSPBRIDGE: check pointer before calling Proc_Detach

Omar Ramirez Luna
2009-12-17T02:08:49Z

From: Ernest Ramos Falcon <ernesto@ti.com>

This patch adds a check before calling Proc_Detach, otherwise
we will see an error.

Signed-off-by: Ernest Ramos Falcon <ernesto@ti.com>
Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
---
drivers/dsp/bridge/rmgr/drv_interface.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c
index a2df832..6415955 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -592,7 +592,8 @@ static int bridge_release(struct inode *ip, struct file *filp)
if (DSP_SUCCEEDED(dsp_status)) {
flush_signals(current);
DRV_RemoveAllResources(pr_ctxt);
- PROC_Detach(pr_ctxt->hProcessor);
+ if (pr_ctxt->hProcessor)
+ PROC_Detach(pr_ctxt->hProcessor);
DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
pr_ctxt, (void *)pr_ctxt->pid);
} else {
--
1.6.2.4