Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
* [PATCH] mfd: omap-usb-tll: handle clk_prepare return code in usbtll_omap_probe
@ 2024-11-06 22:33 Karol Przybylski
  2024-11-06 23:03 ` Shuah Khan
  2024-11-06 23:15 ` Andreas Kemnade
  0 siblings, 2 replies; 8+ messages in thread
From: Karol Przybylski @ 2024-11-06 22:33 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lee, karprzy7
  Cc: linux-omap, linux-kernel, skhan

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 return 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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0f7fdb99c809..28446b082c85 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");
 
@@ -251,7 +251,11 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 		if (IS_ERR(tll->ch_clk[i]))
 			dev_dbg(dev, "can't get clock : %s\n", clkname);
 		else
-			clk_prepare(tll->ch_clk[i]);
+			err = clk_prepare(tll->ch_clk[i]);
+			if (err) {
+				dev_err(dev, "Unable to prepare clock\n");
+				return err;
+	}
 	}
 
 	pm_runtime_put_sync(dev);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-11-12 11:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 22:33 [PATCH] mfd: omap-usb-tll: handle clk_prepare return code in usbtll_omap_probe Karol Przybylski
2024-11-06 23:03 ` Shuah Khan
2024-11-06 23:15 ` Andreas Kemnade
2024-11-07 11:12   ` Karol P
2024-11-09 23:29     ` Andreas Kemnade
2024-11-11 14:41       ` Roger Quadros
2024-11-11 19:57         ` Andreas Kemnade
2024-11-12 11:59           ` Karol P

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox