diff mbox series

spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()

Message ID 20241205070426.1861048-1-psiddaiah@mvista.com (mailing list archive)
State Accepted
Commit 4c6ac5446d060f0bf435ccc8bc3aa7b7b5f718ad
Headers show
Series spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled() | expand

Commit Message

psiddaiah@mvista.com Dec. 5, 2024, 7:04 a.m. UTC
From: Purushothama Siddaiah <psiddaiah@mvista.com>

The devm_clk_get_optional_enabled() function returns error
pointers(PTR_ERR()). So use IS_ERR() to check it.

Verified on K3-J7200 EVM board, without clock node mentioned
in the device tree.

Signed-off-by: Purushothama Siddaiah <psiddaiah@mvista.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
---
 drivers/spi/spi-omap2-mcspi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mark Brown Dec. 5, 2024, 1:41 p.m. UTC | #1
On Thu, 05 Dec 2024 12:34:26 +0530, psiddaiah@mvista.com wrote:
> The devm_clk_get_optional_enabled() function returns error
> pointers(PTR_ERR()). So use IS_ERR() to check it.
> 
> Verified on K3-J7200 EVM board, without clock node mentioned
> in the device tree.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()
      commit: 4c6ac5446d060f0bf435ccc8bc3aa7b7b5f718ad

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index e2400a067a95..add6247d3481 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1561,10 +1561,10 @@  static int omap2_mcspi_probe(struct platform_device *pdev)
 	}
 
 	mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
-	if (mcspi->ref_clk)
-		mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
-	else
+	if (IS_ERR(mcspi->ref_clk))
 		mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
+	else
+		mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
 	ctlr->max_speed_hz = mcspi->ref_clk_hz;
 	ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15;