diff mbox

spi: stm32: Fix error handling in stm32_spi_probe()

Message ID 1522439684-7510-1-git-send-email-khoroshilov@ispras.ru (mailing list archive)
State Accepted
Commit 3dbb3eef91fdb246c7d366b960fe37b66af8ffa9
Headers show

Commit Message

Alexey Khoroshilov March 30, 2018, 7:54 p.m. UTC
clk_get_rate() is below clk_prepare_enable(), so
its error should lead to goto err_clk_disable, not to err_master_put.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Amelie Delaunay April 3, 2018, 7:24 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Alexey Khoroshilov [mailto:khoroshilov@ispras.ru]
> Sent: vendredi 30 mars 2018 21:55
> To: Mark Brown <broonie@kernel.org>; Amelie DELAUNAY
> <amelie.delaunay@st.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>
> Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>; linux-spi@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; ldv-
> project@linuxtesting.org
> Subject: [PATCH] spi: stm32: Fix error handling in stm32_spi_probe()
> 
> clk_get_rate() is below clk_prepare_enable(), so its error should lead to goto
> err_clk_disable, not to err_master_put.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/spi/spi-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index
> ba9743fa2326..ad1e55d3d5d5 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -1129,7 +1129,7 @@ static int stm32_spi_probe(struct platform_device
> *pdev)
>  	if (!spi->clk_rate) {
>  		dev_err(&pdev->dev, "clk rate = 0\n");
>  		ret = -EINVAL;
> -		goto err_master_put;
> +		goto err_clk_disable;
>  	}
> 
>  	spi->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> --
> 2.7.4

Thanks for the patch!

Reviewed-by: Amelie Delaunay <amelie.delaunay@st.com>

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

Patch

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index ba9743fa2326..ad1e55d3d5d5 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1129,7 +1129,7 @@  static int stm32_spi_probe(struct platform_device *pdev)
 	if (!spi->clk_rate) {
 		dev_err(&pdev->dev, "clk rate = 0\n");
 		ret = -EINVAL;
-		goto err_master_put;
+		goto err_clk_disable;
 	}
 
 	spi->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);