From patchwork Wed Jul 1 13:32:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 33478 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n61DWpMW010366 for ; Wed, 1 Jul 2009 13:32:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752390AbZGANcq (ORCPT ); Wed, 1 Jul 2009 09:32:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752342AbZGANcq (ORCPT ); Wed, 1 Jul 2009 09:32:46 -0400 Received: from smtp.nokia.com ([192.100.105.134]:21071 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751988AbZGANcq (ORCPT ); Wed, 1 Jul 2009 09:32:46 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n61DWiYU011880; Wed, 1 Jul 2009 08:32:48 -0500 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jul 2009 16:32:43 +0300 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jul 2009 16:32:41 +0300 Received: from localhost.localdomain (esdhcp041119.research.nokia.com [172.21.41.119]) by mgw-sa01.ext.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n61DWdfF008388; Wed, 1 Jul 2009 16:32:39 +0300 From: Ameya Palande To: linux-omap@vger.kernel.org Cc: h-kanigeri2@ti.com, omar.ramirez@ti.com, x0095840@ti.com Subject: [PATCH] DSPBRIDGE: Fixes the DSP crash when driver is unloaded. Date: Wed, 1 Jul 2009 16:32:39 +0300 Message-Id: <1246455159-7420-1-git-send-email-ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.2.4 X-OriginalArrivalTime: 01 Jul 2009 13:32:41.0503 (UTC) FILETIME=[688AE2F0:01C9FA50] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Roman Tereshonkov clk_notifier_unregister should be run before data structures are freed, otherwise it will try to access to NULLed data. Signed-off-by: Roman Tereshonkov Signed-off-by: Hari Kanigeri --- drivers/dsp/bridge/rmgr/drv_interface.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c index f41e153..12b140c 100644 --- a/drivers/dsp/bridge/rmgr/drv_interface.c +++ b/drivers/dsp/bridge/rmgr/drv_interface.c @@ -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) {