[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241211185028.3841047-31-sashal@kernel.org>
Date: Wed, 11 Dec 2024 13:49:47 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Purushothama Siddaiah <psiddaiah@...sta.com>,
Corey Minyard <cminyard@...sta.com>,
Mark Brown <broonie@...nel.org>,
Sasha Levin <sashal@...nel.org>,
linux-spi@...r.kernel.org
Subject: [PATCH AUTOSEL 6.12 31/36] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()
From: Purushothama Siddaiah <psiddaiah@...sta.com>
[ Upstream commit 4c6ac5446d060f0bf435ccc8bc3aa7b7b5f718ad ]
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@...sta.com>
Reviewed-by: Corey Minyard <cminyard@...sta.com>
Link: https://patch.msgid.link/20241205070426.1861048-1-psiddaiah@mvista.com
Signed-off-by: Mark Brown <broonie@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/spi/spi-omap2-mcspi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 2c043817c66a8..4a2f84c4d22e5 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;
--
2.43.0
Powered by blists - more mailing lists