Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexey Khoroshilov and committed by
Mark Brown
ded5fa4e 0a090d65

+8 -3
+8 -3
drivers/spi/spi-meson-spicc.c
··· 574 574 master->max_speed_hz = rate >> 2; 575 575 576 576 ret = devm_spi_register_master(&pdev->dev, master); 577 - if (!ret) 578 - return 0; 577 + if (ret) { 578 + dev_err(&pdev->dev, "spi master registration failed\n"); 579 + goto out_clk; 580 + } 579 581 580 - dev_err(&pdev->dev, "spi master registration failed\n"); 582 + return 0; 583 + 584 + out_clk: 585 + clk_disable_unprepare(spicc->core); 581 586 582 587 out_master: 583 588 spi_master_put(master);