DSPBRIDGE: Fixes the DSP crash when driver is unloaded.
PATCH 1/1 DSPBRIDGE: Fixes the DSP crash when driver is unloaded.
From: Roman Tereshonkov <[email protected]>
clk_notifier_unregister should be run before data structures are freed, otherwise it will try to access to NULLed data.
--- drivers/dsp/bridge/rmgr/drv_interface.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-)
drivers/dsp/bridge/rmgr/drv_interface.c +16 -13
@@ -452,6 +452,17 @@ static int __devexit omap34xx_bridge_remove(struct platform_device *pdev) dsp_status =CFG_GetObject ((u32 *)&hDrvObject,REG_DRV_OBJECT );if (DSP_FAILED (dsp_status)) goto func_cont; + +#ifdef CONFIG_BRIDGE_DVFS +if (!clk_notifier_unregister (clk_handle, &iva_clk_notifier)) { +GT_0trace (driverTrace,GT_7CLASS , +"clk_notifier_unregister PASS for iva2_ck \n" ); + }else { +GT_0trace (driverTrace,GT_7CLASS , +"clk_notifier_unregister FAILED for iva2_ck \n" ); + } +#endif /* #ifdef CONFIG_BRIDGE_DVFS */ +DRV_GetProcCtxtList (&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);while (pCtxtclosed !=NULL ) { GT_1trace(driverTrace, GT_5CLASS, "***Cleanup of "
@@ -463,28 +474,20 @@ static int __devexit omap34xx_bridge_remove(struct platform_device *pdev) pCtxtclosed, (void *)pCtxtclosed->pid); pCtxtclosed = pTmp; } -func_cont: +if (driverContext) {/* Put the DSP in reset state */ ret =DSP_Deinit (driverContext); driverContext =0 ;DBC_Assert (ret == true); } -SERVICES_Exit (); -GT_exit (); -/* unregister the clock notifier */ -#ifdef CONFIG_BRIDGE_DVFS -if (!clk_notifier_unregister (clk_handle, &iva_clk_notifier)) { -GT_0trace (driverTrace,GT_7CLASS , -"clk_notifier_unregister PASS for iva2_ck \n" ); - }else { -GT_0trace (driverTrace,GT_7CLASS , -"clk_notifier_unregister PASS for iva2_ck \n" ); - }clk_put (clk_handle); clk_handle =NULL ; -#endif /* #ifdef CONFIG_BRIDGE_DVFS */ + +func_cont: +SERVICES_Exit (); +GT_exit (); devno =MKDEV (driver_major, driver_minor);if (bridge_device) {
Signature · 1 line
1.6.2.4
Hi Ameya,
I have test the patch and it works and fixes the problem, thanks.
Quoted 77 lines
-----Original Message-----
From: Ameya Palande [mailto:[email protected]]
Sent: Wednesday, July 01, 2009 8:33 AM
To: [email protected]
Cc: Kanigeri, Hari; Ramirez Luna, Omar; Guzman Lugo, Fernando
Subject: [PATCH] DSPBRIDGE: Fixes the DSP crash when driver is unloaded.From: Roman Tereshonkov <[email protected]>
clk_notifier_unregistershould be run before data structures are freed, otherwise it will try to access to NULLed data.Signed-off-by Roman Tereshonkov <[email protected]>Signed-off-by Hari Kanigeri <[email protected]>--- drivers/dsp/bridge/rmgr/drv_interface.c | 29 ++++++++++++++++---------- --- 1 files changed, 16 insertions(+), 13 deletions(-)drivers/dsp/bridge/rmgr/drv_interface.c +11
-0@@ -452,6 +452,17 @@ static int __devexit omap34xx_bridge_remove(struct platform_device *pdev) dsp_status =CFG_GetObject ((u32 *)&hDrvObject,REG_DRV_OBJECT );if (DSP_FAILED (dsp_status)) goto func_cont; + +#ifdef CONFIG_BRIDGE_DVFS +if (!clk_notifier_unregister (clk_handle, &iva_clk_notifier)) { +GT_0trace (driverTrace,GT_7CLASS , +"clk_notifier_unregister PASS for iva2_ck \n" ); + }else { +GT_0trace (driverTrace,GT_7CLASS , +"clk_notifier_unregister FAILED for iva2_ck \n" ); + } +#endif /* #ifdef CONFIG_BRIDGE_DVFS */ +DRV_GetProcCtxtList (&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);while (pCtxtclosed !=NULL ) {drivers/dsp/bridge/rmgr/drv_interface.c +5
-13GT_1trace(driverTrace, GT_5CLASS, "***Cleanup of "@@ -463,28 +474,20 @@ static int __devexit omap34xx_bridge_remove(struct platform_device *pdev) pCtxtclosed, (void *)pCtxtclosed->pid); pCtxtclosed = pTmp; } -func_cont: +if (driverContext) {/* Put the DSP in reset state */ ret =DSP_Deinit (driverContext); driverContext =0 ;DBC_Assert (ret == true); } -SERVICES_Exit (); -GT_exit (); -/* unregister the clock notifier */ -#ifdef CONFIG_BRIDGE_DVFS -if (!clk_notifier_unregister (clk_handle, &iva_clk_notifier)) { -GT_0trace (driverTrace,GT_7CLASS , -"clk_notifier_unregister PASS for iva2_ck \n" ); - }else { -GT_0trace (driverTrace,GT_7CLASS , -"clk_notifier_unregister PASS for iva2_ck \n" ); - }clk_put (clk_handle); clk_handle =NULL ; -#endif /* #ifdef CONFIG_BRIDGE_DVFS */ + +func_cont: +SERVICES_Exit (); +GT_exit (); devno =MKDEV (driver_major, driver_minor);
Quoted 4 lines
if (
bridge_device) {
--
1.6.2.4
Acked-by Fernando Guzman Lugo <[email protected]>