LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] spi: meson-axg: Fix error handling in meson_spicc_probe()
@ 2018-04-13 21:39 Alexey Khoroshilov
  2018-04-26  8:35 ` Neil Armstrong
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Khoroshilov @ 2018-04-13 21:39 UTC (permalink / raw)
  To: Mark Brown, Carlo Caione, Kevin Hilman, Neil Armstrong
  Cc: Alexey Khoroshilov, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-kernel, ldv-project

If devm_spi_register_master() fails in meson_spicc_probe(),
spicc->core is left undisabled. The patch fixes that.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/spi/spi-meson-spicc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index 5c82910e3480..7fe4488ace57 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -574,10 +574,15 @@ static int meson_spicc_probe(struct platform_device *pdev)
 		master->max_speed_hz = rate >> 2;
 
 	ret = devm_spi_register_master(&pdev->dev, master);
-	if (!ret)
-		return 0;
+	if (ret) {
+		dev_err(&pdev->dev, "spi master registration failed\n");
+		goto out_clk;
+	}
 
-	dev_err(&pdev->dev, "spi master registration failed\n");
+	return 0;
+
+out_clk:
+	clk_disable_unprepare(spicc->core);
 
 out_master:
 	spi_master_put(master);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: meson-axg: Fix error handling in meson_spicc_probe()
  2018-04-13 21:39 [PATCH] spi: meson-axg: Fix error handling in meson_spicc_probe() Alexey Khoroshilov
@ 2018-04-26  8:35 ` Neil Armstrong
  2018-04-28 22:46   ` [PATCH v2] spi: meson-spicc: " Alexey Khoroshilov
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Armstrong @ 2018-04-26  8:35 UTC (permalink / raw)
  To: Alexey Khoroshilov, Mark Brown, Carlo Caione, Kevin Hilman
  Cc: linux-spi, linux-arm-kernel, linux-amlogic, linux-kernel, ldv-project

Hi Alexey,


On 13/04/2018 23:39, Alexey Khoroshilov wrote:
> If devm_spi_register_master() fails in meson_spicc_probe(),
> spicc->core is left undisabled. The patch fixes that.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/spi/spi-meson-spicc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
> index 5c82910e3480..7fe4488ace57 100644
> --- a/drivers/spi/spi-meson-spicc.c
> +++ b/drivers/spi/spi-meson-spicc.c
> @@ -574,10 +574,15 @@ static int meson_spicc_probe(struct platform_device *pdev)
>  		master->max_speed_hz = rate >> 2;
>  
>  	ret = devm_spi_register_master(&pdev->dev, master);
> -	if (!ret)
> -		return 0;
> +	if (ret) {
> +		dev_err(&pdev->dev, "spi master registration failed\n");
> +		goto out_clk;
> +	}
>  
> -	dev_err(&pdev->dev, "spi master registration failed\n");
> +	return 0;
> +
> +out_clk:
> +	clk_disable_unprepare(spicc->core);
>  
>  out_master:
>  	spi_master_put(master);
> 

The correct subject should be "spi: meson-spicc:"

Apart that :
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Neil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] spi: meson-spicc: Fix error handling in meson_spicc_probe()
  2018-04-26  8:35 ` Neil Armstrong
@ 2018-04-28 22:46   ` Alexey Khoroshilov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2018-04-28 22:46 UTC (permalink / raw)
  To: Mark Brown, Neil Armstrong
  Cc: Alexey Khoroshilov, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-kernel, ldv-project

If devm_spi_register_master() fails in meson_spicc_probe(),
spicc->core is left undisabled. The patch fixes that.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
---
v2: Fix subject as Neil Armstrong noted.

 drivers/spi/spi-meson-spicc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index 5c82910e3480..7fe4488ace57 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -574,10 +574,15 @@ static int meson_spicc_probe(struct platform_device *pdev)
 		master->max_speed_hz = rate >> 2;
 
 	ret = devm_spi_register_master(&pdev->dev, master);
-	if (!ret)
-		return 0;
+	if (ret) {
+		dev_err(&pdev->dev, "spi master registration failed\n");
+		goto out_clk;
+	}
 
-	dev_err(&pdev->dev, "spi master registration failed\n");
+	return 0;
+
+out_clk:
+	clk_disable_unprepare(spicc->core);
 
 out_master:
 	spi_master_put(master);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-28 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 21:39 [PATCH] spi: meson-axg: Fix error handling in meson_spicc_probe() Alexey Khoroshilov
2018-04-26  8:35 ` Neil Armstrong
2018-04-28 22:46   ` [PATCH v2] spi: meson-spicc: " Alexey Khoroshilov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).