diff mbox series

mfd: omap-usb-tll: check clk_prepare return code

Message ID 20241113211614.518439-1-karprzy7@gmail.com (mailing list archive)
State New
Headers show
Series mfd: omap-usb-tll: check clk_prepare return code | expand

Commit Message

Karol Przybylski Nov. 13, 2024, 9:16 p.m. UTC
clk_prepare() is called in usbtll_omap_probe to fill clk array.
Return code is not checked, leaving possible error condition unhandled.

Added variable to hold return value from clk_prepare() and dev_dbg statement
when it's not successful.

Found in coverity scan, CID 1594680

Signed-off-by: Karol Przybylski <karprzy7@gmail.com>
---
 drivers/mfd/omap-usb-tll.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0f7fdb99c809..2e9319ee1b74 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -202,7 +202,7 @@  static int usbtll_omap_probe(struct platform_device *pdev)
 	struct device				*dev =  &pdev->dev;
 	struct usbtll_omap			*tll;
 	void __iomem				*base;
-	int					i, nch, ver;
+	int					i, nch, ver, err;
 
 	dev_dbg(dev, "starting TI HSUSB TLL Controller\n");
 
@@ -248,10 +248,13 @@  static int usbtll_omap_probe(struct platform_device *pdev)
 					"usb_tll_hs_usb_ch%d_clk", i);
 		tll->ch_clk[i] = clk_get(dev, clkname);
 
-		if (IS_ERR(tll->ch_clk[i]))
+		if (IS_ERR(tll->ch_clk[i])) {
 			dev_dbg(dev, "can't get clock : %s\n", clkname);
-		else
-			clk_prepare(tll->ch_clk[i]);
+		} else {
+			err = clk_prepare(tll->ch_clk[i]);
+			if (err)
+				dev_dbg(dev, "clock prepare error for: %s\n", clkname);
+		}
 	}
 
 	pm_runtime_put_sync(dev);