Skip to content

Commit 5812175

Browse files
Yang Yinglianggregkh
authored andcommitted
usb: dwc3-am62: remove unnecesary clk_put()
The clk get by devm_clk_get() will be released in devres_release_all(), so there is no need explicitly call clk_put(), or it will cause UAF. Fixes: e8784c0 ("drivers: usb: dwc3: Add AM62 USB wrapper driver") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7441b27 commit 5812175

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/usb/dwc3/dwc3-am62.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,15 @@ static int dwc3_ti_probe(struct platform_device *pdev)
195195

196196
if (i == ARRAY_SIZE(dwc3_ti_rate_table)) {
197197
dev_err(dev, "unsupported usb2_refclk rate: %lu KHz\n", rate);
198-
ret = -EINVAL;
199-
goto err_clk_disable;
198+
return -EINVAL;
200199
}
201200

202201
data->rate_code = i;
203202

204203
/* Read the syscon property and set the rate code */
205204
ret = phy_syscon_pll_refclk(data);
206205
if (ret)
207-
goto err_clk_disable;
206+
return ret;
208207

209208
/* VBUS divider select */
210209
data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider");
@@ -245,8 +244,6 @@ static int dwc3_ti_probe(struct platform_device *pdev)
245244
clk_disable_unprepare(data->usb2_refclk);
246245
pm_runtime_disable(dev);
247246
pm_runtime_set_suspended(dev);
248-
err_clk_disable:
249-
clk_put(data->usb2_refclk);
250247
return ret;
251248
}
252249

@@ -276,7 +273,6 @@ static int dwc3_ti_remove(struct platform_device *pdev)
276273
pm_runtime_disable(dev);
277274
pm_runtime_set_suspended(dev);
278275

279-
clk_put(data->usb2_refclk);
280276
platform_set_drvdata(pdev, NULL);
281277
return 0;
282278
}

0 commit comments

Comments
 (0)