From 6875d3d22c455ce42aa86be66f1c196bb0e570de Mon Sep 17 00:00:00 2001 From: Dariusz Szymczak Date: Fri, 18 Jun 2010 16:19:49 +0200 Subject: ste_conn_driver: Fix crash if no patch file found If no patch file has been found for the connected chip the device struct is freed by calling ste_conn_reset(). Then the ste_conn_register() will try to free the same struct again which will cause a kernel crash. There is no need to do a reset of the whole driver when the chip startup has failed, it's enough to call the cpd_chip_shutdown() instead of ste_conn_reset() and let the ste_conn_register() free the dev struct. ST-Ericsson ID: ER264360 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/1750 Reviewed-by: Magnus MALMBORN Reviewed-by: Dariusz SZYMCZAK Tested-by: Dariusz SZYMCZAK Reviewed-by: Par-Gunnar HJALMDAHL Reviewed-by: Jonas ABERG Signed-off-by: Mian Yousaf Kaukab Change-Id: I9dfdefd435d3e7b6f35f0a9a613a4b879f22bd41 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2630 --- drivers/mfd/ste_conn/ste_conn_cpd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/ste_conn/ste_conn_cpd.c b/drivers/mfd/ste_conn/ste_conn_cpd.c index c675677e51f..759410cbd8d 100644 --- a/drivers/mfd/ste_conn/ste_conn_cpd.c +++ b/drivers/mfd/ste_conn/ste_conn_cpd.c @@ -784,12 +784,14 @@ int ste_conn_cpd_chip_startup_finished(int err) STE_CONN_INFO("ste_conn_cpd_chip_startup_finished (%d)", err); if (err) { - ste_conn_reset(NULL); + /* Shutdown the chip */ + cpd_chip_shutdown(); } else { CPD_SET_MAIN_STATE(CPD_STATE_ACTIVE); - wake_up_interruptible(&ste_conn_cpd_wait_queue); } + wake_up_interruptible(&ste_conn_cpd_wait_queue); + return ret_val; } EXPORT_SYMBOL(ste_conn_cpd_chip_startup_finished); -- cgit v1.2.3