Commit b46c89c0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 917846e9 a07eb4f6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -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;