[PATCH] spi: jcore: disable clock when registering spi conroller failed

2017-12-07 Thread Takuo Koguchi
 When probe function fails in registering the spi controller, the clock
 should remain disabled.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi 
---
 Compiled test only, no runtime test done.
 
 drivers/spi/spi-jcore.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
index cebfea5..dafed62 100644
--- a/drivers/spi/spi-jcore.c
+++ b/drivers/spi/spi-jcore.c
@@ -198,8 +198,10 @@ static int jcore_spi_probe(struct platform_device *pdev)
 
/* Register our spi controller */
err = devm_spi_register_master(&pdev->dev, master);
-   if (err)
+   if (err) {
+   clk_disable(clk);
goto exit;
+   }
 
return 0;
 
-- 
2.7.4



[PATCH] spi: jcore: disable clock when registering spi conroller

2017-12-07 Thread Takuo Koguchi
 failed When probe function fails in registering the spi controller, the clock
 should remain disabled.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi 
---
 Compiled test only, no runtime test done.
 
 drivers/spi/spi-jcore.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
index cebfea5..dafed62 100644
--- a/drivers/spi/spi-jcore.c
+++ b/drivers/spi/spi-jcore.c
@@ -198,8 +198,10 @@ static int jcore_spi_probe(struct platform_device *pdev)
 
/* Register our spi controller */
err = devm_spi_register_master(&pdev->dev, master);
-   if (err)
+   if (err) {
+   clk_disable(clk);
goto exit;
+   }
 
return 0;
 
-- 
2.7.4



[PATCH] spi: jcore: disable clock when registering spi conroller failed When probe function fails in registering the spi controller, the clock should remain disabled.

2017-12-07 Thread Takuo Koguchi
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi 
---
 Compiled test only, no runtime test done.
 
 drivers/spi/spi-jcore.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
index cebfea5..dafed62 100644
--- a/drivers/spi/spi-jcore.c
+++ b/drivers/spi/spi-jcore.c
@@ -198,8 +198,10 @@ static int jcore_spi_probe(struct platform_device *pdev)
 
/* Register our spi controller */
err = devm_spi_register_master(&pdev->dev, master);
-   if (err)
+   if (err) {
+   clk_disable(clk);
goto exit;
+   }
 
return 0;
 
-- 
2.7.4



[PATCH V3] spi: sun4i: disable clocks in the remove function

2017-12-06 Thread Takuo Koguchi
mclk and hclk need to be disabled. Since pm_runtime_disable does
not disable the clocks, use pm_runtime_force_suspend instead.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi 
---
 V3: remove redundant pm_runtime_disable call.
 Compile test only, no runtime test done.
 drivers/spi/spi-sun4i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
index c5cd635..4141003 100644
--- a/drivers/spi/spi-sun4i.c
+++ b/drivers/spi/spi-sun4i.c
@@ -525,7 +525,7 @@ static int sun4i_spi_probe(struct platform_device *pdev)
 
 static int sun4i_spi_remove(struct platform_device *pdev)
 {
-   pm_runtime_disable(&pdev->dev);
+   pm_runtime_force_suspend(&pdev->dev);
 
return 0;
 }
-- 
2.7.4



[PATCH] spi: sun4i: disable clocks in the remove function

2017-12-06 Thread Takuo Koguchi
mclk and hclk need to be disabled since pm_runtime_disable does
not disable the clocks.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi 
---
 V2: use pm_runtime_force_suspend to avoid unbalance disable
 call.
 Compile test only, no runtime test.
 drivers/spi/spi-sun4i.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
index c5cd635..ca733b2 100644
--- a/drivers/spi/spi-sun4i.c
+++ b/drivers/spi/spi-sun4i.c
@@ -525,6 +525,7 @@ static int sun4i_spi_probe(struct platform_device *pdev)
 
 static int sun4i_spi_remove(struct platform_device *pdev)
 {
+   pm_runtime_force_suspend(&pdev->dev);
pm_runtime_disable(&pdev->dev);
 
return 0;
-- 
2.7.4



[PATCH] spi: sun4i: disable clocks in the remove function

2017-12-06 Thread Takuo Koguchi
mclk and hclk need to be disabled explicitly since pm_runtime_disable does
not disable the clocks.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi 
---
 drivers/spi/spi-sun4i.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
index c5cd635..9011c09 100644
--- a/drivers/spi/spi-sun4i.c
+++ b/drivers/spi/spi-sun4i.c
@@ -525,6 +525,11 @@ static int sun4i_spi_probe(struct platform_device *pdev)
 
 static int sun4i_spi_remove(struct platform_device *pdev)
 {
+   struct spi_master *master = dev_get_drvdata(&pdev->dev);
+   struct sun4i_spi *sspi = spi_master_get_devdata(master);
+
+   clk_disable_unprepare(sspi->mclk);
+   clk_disable_unprepare(sspi->hclk);
pm_runtime_disable(&pdev->dev);
 
return 0;
-- 
2.7.4