[PATCH 1/3] usb: dwc3: handle return value of clk_get_rate() correctly
Yang Xiwen via B4 Relay
devnull+forbidden405.outlook.com at kernel.org
Sat Feb 3 00:01:54 CET 2024
From: Yang Xiwen <forbidden405 at outlook.com>
clk_get_rate() return -ve on error, not 0. Fix it by replacing judging
NULL with IS_ERR_VALUE().
Fixes: 6bae0eb5b8bd("usb: dwc3: Calculate REFCLKPER based on reference clock")
Signed-off-by: Yang Xiwen <forbidden405 at outlook.com>
---
drivers/usb/dwc3/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 4b4fcd8a22..06ff68105e 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -137,7 +137,7 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc)
if (dwc->ref_clk) {
rate = clk_get_rate(dwc->ref_clk);
- if (!rate)
+ if (IS_ERR_VALUE(rate))
return;
period = NSEC_PER_SEC / rate;
} else {
--
2.43.0
More information about the U-Boot
mailing list