Skip to content

Commit 4c6ac54

Browse files
psiddaiahbroonie
authored andcommitted
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>
1 parent ceb259e commit 4c6ac54

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/spi/spi-omap2-mcspi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,10 +1561,10 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
15611561
}
15621562

15631563
mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
1564-
if (mcspi->ref_clk)
1565-
mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
1566-
else
1564+
if (IS_ERR(mcspi->ref_clk))
15671565
mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
1566+
else
1567+
mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
15681568
ctlr->max_speed_hz = mcspi->ref_clk_hz;
15691569
ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15;
15701570

0 commit comments

Comments
 (0)