Skip to content

Commit

Permalink
Merge tag 'spi-fix-v6.14-merge-window' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/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
  • Loading branch information
Linus Torvalds committed Jan 25, 2025
2 parents 917846e + a07eb4f commit b46c89c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/spi/spi-omap2-mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b46c89c

Please sign in to comment.