From: Bartlomiej Zolnierkiewicz Date: Thu, 7 Aug 2014 16:07:07 +0000 (+0200) Subject: mmc: sdhci-s3c: fix runtime PM handling on sdhci_add_host() failure X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=221414db1934c1c883501998f510bb75acfbaa51;p=linux-beck.git mmc: sdhci-s3c: fix runtime PM handling on sdhci_add_host() failure Runtime Power Management handling for the sdhci_add_host() failure case in sdhci_s3c_probe() should match the code in sdhci_s3c_remove() (which uses pm_runtime_disable() call which matches the earlier pm_runtime_enable() one). Fix it. This patch fixes "BUG: spinlock bad magic on CPU#0, swapper/0/1" and "Unbalanced pm_runtime_enable!" warnings. >From the kernel log: ... [ 1.659631] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed [ 1.665096] BUG: spinlock bad magic on CPU#0, swapper/0/1 [ 1.670433] lock: 0xea01e484, .magic: 00000000, .owner: /-1, .owner_cpu: 0 [ 1.677895] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.0-next-20140804-00008-ga59480f-dirty #707 [ 1.687037] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 1.694740] [] (show_stack) from [] (dump_stack+0x68/0xb8) [ 1.701948] [] (dump_stack) from [] (do_raw_spin_lock+0x15c/0x1a4) [ 1.709848] [] (do_raw_spin_lock) from [] (_raw_spin_lock_irqsave+0x20/0x28) [ 1.718619] [] (_raw_spin_lock_irqsave) from [] (sdhci_do_set_ios+0x1c/0x5cc) [ 1.727464] [] (sdhci_do_set_ios) from [] (sdhci_runtime_resume_host+0x50/0x104) [ 1.736574] [] (sdhci_runtime_resume_host) from [] (pm_generic_runtime_resume+0x2c/0x40) [ 1.746383] [] (pm_generic_runtime_resume) from [] (__rpm_callback+0x34/0x70) [ 1.755233] [] (__rpm_callback) from [] (rpm_callback+0x28/0x88) [ 1.762958] [] (rpm_callback) from [] (rpm_resume+0x384/0x4ec) [ 1.770511] [] (rpm_resume) from [] (pm_runtime_forbid+0x58/0x64) [ 1.778325] [] (pm_runtime_forbid) from [] (sdhci_s3c_probe+0x4a4/0x540) [ 1.786749] [] (sdhci_s3c_probe) from [] (platform_drv_probe+0x2c/0x5c) [ 1.795076] [] (platform_drv_probe) from [] (driver_probe_device+0x114/0x234) [ 1.803929] [] (driver_probe_device) from [] (__driver_attach+0x8c/0x90) [ 1.812347] [] (__driver_attach) from [] (bus_for_each_dev+0x54/0x88) [ 1.820506] [] (bus_for_each_dev) from [] (bus_add_driver+0xd8/0x1cc) [ 1.828665] [] (bus_add_driver) from [] (driver_register+0x78/0xf4) [ 1.836652] [] (driver_register) from [] (do_one_initcall+0x80/0x1d0) [ 1.844816] [] (do_one_initcall) from [] (kernel_init_freeable+0x108/0x1d4) [ 1.853503] [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4) [ 1.861568] [] (kernel_init) from [] (ret_from_fork+0x14/0x3c) [ 1.869582] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral ... [ 1.997047] s3c-sdhci 12530000.sdhci: Unbalanced pm_runtime_enable! ... [ 2.027235] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed [ 2.032884] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral ... Tested on Hardkernel's Exynos4412 based ODROID-U3 board. Fixes: 9f4e8151dbbc ("mmc: sdhci-s3c: Enable runtime power management") Cc: Mark Brown Cc: Jaehoon Chung Cc: Ben Dooks Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Kyungmin Park Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index fa5954a05449..1e47903fa184 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -606,8 +606,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev) ret = sdhci_add_host(host); if (ret) { dev_err(dev, "sdhci_add_host() failed\n"); - pm_runtime_forbid(&pdev->dev); - pm_runtime_get_noresume(&pdev->dev); goto err_req_regs; } @@ -618,6 +616,8 @@ static int sdhci_s3c_probe(struct platform_device *pdev) return 0; err_req_regs: + pm_runtime_disable(&pdev->dev); + err_no_busclks: clk_disable_unprepare(sc->clk_io);