1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

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

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>
Link: https://patch.msgid.link/20241205070426.1861048-1-psiddaiah@mvista.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Purushothama Siddaiah 2024-12-05 12:34:26 +05:30 committed by Mark Brown
parent ceb259e43b
commit 4c6ac5446d
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -1561,10 +1561,10 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
} }
mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
if (mcspi->ref_clk) if (IS_ERR(mcspi->ref_clk))
mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
else
mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ; 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->max_speed_hz = mcspi->ref_clk_hz;
ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15; ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15;