Commit 58121753 authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman

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: e8784c0a ("drivers: usb: dwc3: Add AM62 USB wrapper driver")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220629094635.3116961-1-yangyingliang@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7441b273
...@@ -195,8 +195,7 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -195,8 +195,7 @@ static int dwc3_ti_probe(struct platform_device *pdev)
if (i == ARRAY_SIZE(dwc3_ti_rate_table)) { if (i == ARRAY_SIZE(dwc3_ti_rate_table)) {
dev_err(dev, "unsupported usb2_refclk rate: %lu KHz\n", rate); dev_err(dev, "unsupported usb2_refclk rate: %lu KHz\n", rate);
ret = -EINVAL; return -EINVAL;
goto err_clk_disable;
} }
data->rate_code = i; data->rate_code = i;
...@@ -204,7 +203,7 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -204,7 +203,7 @@ static int dwc3_ti_probe(struct platform_device *pdev)
/* Read the syscon property and set the rate code */ /* Read the syscon property and set the rate code */
ret = phy_syscon_pll_refclk(data); ret = phy_syscon_pll_refclk(data);
if (ret) if (ret)
goto err_clk_disable; return ret;
/* VBUS divider select */ /* VBUS divider select */
data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider");
...@@ -245,8 +244,6 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -245,8 +244,6 @@ static int dwc3_ti_probe(struct platform_device *pdev)
clk_disable_unprepare(data->usb2_refclk); clk_disable_unprepare(data->usb2_refclk);
pm_runtime_disable(dev); pm_runtime_disable(dev);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
err_clk_disable:
clk_put(data->usb2_refclk);
return ret; return ret;
} }
...@@ -276,7 +273,6 @@ static int dwc3_ti_remove(struct platform_device *pdev) ...@@ -276,7 +273,6 @@ static int dwc3_ti_remove(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
clk_put(data->usb2_refclk);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment