diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2018-04-29 00:46:23 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-05-01 22:59:21 +0200 |
commit | ded5fa4e8bac25612caab8f0822691308a28a552 (patch) | |
tree | 67e1bc7cfd385d661e86353d405e6ee8a70e5627 /drivers/spi | |
parent | spi: mpc52xx: Use gpio_is_valid() (diff) | |
download | linux-ded5fa4e8bac25612caab8f0822691308a28a552.tar.xz linux-ded5fa4e8bac25612caab8f0822691308a28a552.zip |
spi: meson-spicc: Fix error handling in meson_spicc_probe()
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-meson-spicc.c | 11 |
1 files 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); |