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
This commit is contained in:
Linus Torvalds
2025-01-24 16:12:12 -08:00

View File

@@ -1561,10 +1561,15 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
}
mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
if (IS_ERR(mcspi->ref_clk))
mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
else
if (IS_ERR(mcspi->ref_clk)) {
status = PTR_ERR(mcspi->ref_clk);
dev_err_probe(&pdev->dev, status, "Failed to get ref_clk");
goto free_ctlr;
}
if (mcspi->ref_clk)
mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
else
mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
ctlr->max_speed_hz = mcspi->ref_clk_hz;
ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15;