spi: stm32: Fix error handling in stm32_spi_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 30 Mar 2018 19:54:44 +0000 (22:54 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 17 Apr 2018 10:46:23 +0000 (11:46 +0100)
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>
Reviewed-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-stm32.c

index ba9743fa2326d11689384e47c84da4068c9fc521..ad1e55d3d5d596e26b25ca8b49aa23fc63b3748d 100644 (file)
@@ -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);