Skip to content

Commit b46c89c

Browse files
committed
Merge tag 'spi-fix-v6.14-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fix from Mark Brown: "A simple fix for mishandling of some clk_get_optional() return codes in the OMAP driver, the problem was reported against stable kernels on a few platforms after an earlier incomplete fix was backported" * tag 'spi-fix-v6.14-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: omap2-mcspi: Correctly handle devm_clk_get_optional() errors
2 parents 917846e + a07eb4f commit b46c89c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/spi/spi-omap2-mcspi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,10 +1561,15 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
15611561
}
15621562

15631563
mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
1564-
if (IS_ERR(mcspi->ref_clk))
1565-
mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
1566-
else
1564+
if (IS_ERR(mcspi->ref_clk)) {
1565+
status = PTR_ERR(mcspi->ref_clk);
1566+
dev_err_probe(&pdev->dev, status, "Failed to get ref_clk");
1567+
goto free_ctlr;
1568+
}
1569+
if (mcspi->ref_clk)
15671570
mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
1571+
else
1572+
mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
15681573
ctlr->max_speed_hz = mcspi->ref_clk_hz;
15691574
ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15;
15701575

0 commit comments

Comments
 (0)