mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
BACKPORT: usb: dwc3: core: fix some leaks in probe
The dwc3_get_properties() function calls: dwc->usb_psy = power_supply_get_by_name(usb_psy_name); so there is some additional clean up required on these error paths. Bug: 254441685 Fixes:6f0764b5ad("usb: dwc3: add a power supply for current control") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YyxFYFnP53j9sCg+@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit2a735e4b55) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: Ic8833e7db878998bb88baaf6d396aa8dcfd4984f
This commit is contained in:
committed by
Treehugger Robot
parent
e1b3243fcb
commit
94ce24b0ce
@@ -1574,13 +1574,17 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||
dwc3_get_properties(dwc);
|
||||
|
||||
dwc->reset = devm_reset_control_array_get_optional_shared(dev);
|
||||
if (IS_ERR(dwc->reset))
|
||||
return PTR_ERR(dwc->reset);
|
||||
if (IS_ERR(dwc->reset)) {
|
||||
ret = PTR_ERR(dwc->reset);
|
||||
goto put_usb_psy;
|
||||
}
|
||||
|
||||
if (dev->of_node) {
|
||||
ret = devm_clk_bulk_get_all(dev, &dwc->clks);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
return ret;
|
||||
if (ret == -EPROBE_DEFER) {
|
||||
goto put_usb_psy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clocks are optional, but new DT platforms should support all
|
||||
* clocks as required by the DT-binding.
|
||||
@@ -1589,12 +1593,11 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||
dwc->num_clks = 0;
|
||||
else
|
||||
dwc->num_clks = ret;
|
||||
|
||||
}
|
||||
|
||||
ret = reset_control_deassert(dwc->reset);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto put_usb_psy;
|
||||
|
||||
ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks);
|
||||
if (ret)
|
||||
@@ -1694,7 +1697,7 @@ disable_clks:
|
||||
clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks);
|
||||
assert_reset:
|
||||
reset_control_assert(dwc->reset);
|
||||
|
||||
put_usb_psy:
|
||||
if (dwc->usb_psy)
|
||||
power_supply_put(dwc->usb_psy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user