[PATCH] spi: pxa2xx: Disable runtime PM if controller registration fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't leave runtime PM enabled in case devm_spi_register_controller()
returns with an error. Otherwise runtime PM will complain when driver is
reloaded:

[  693.855811] pxa2xx-spi pxa2xx-spi.13: Unbalanced pm_runtime_enable!

Signed-off-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
---
This can be hit quite easily when breaking the rmmod/modprobe loop with
CTRL+C and kthread startup in spi_init_queue() is interrupted.

while :; do rmmod spi_pxa2xx_platform ; modprobe spi_pxa2xx_platform; done
[  688.501525] spi_master spi2: failed to create message pump task
[  688.508235] spi_master spi2: problem initializing queue
[  688.514328] pxa2xx-spi pxa2xx-spi.13: problem registering spi master
[  688.521529] pxa2xx-spi: probe of pxa2xx-spi.13 failed with error -4
...
[  693.855811] pxa2xx-spi pxa2xx-spi.13: Unbalanced pm_runtime_enable!
---
 drivers/spi/spi-pxa2xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 713506eff07d..82dcb88fcfba 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1806,6 +1806,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
 	return status;
 
 out_error_clock_enabled:
+	pm_runtime_put_noidle(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	clk_disable_unprepare(ssp->clk);
 	pxa2xx_spi_dma_release(drv_data);
 	free_irq(ssp->irq, drv_data);
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux