mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
usb: dwc3-msm: Fix invalid usb_psy access during remove
The "qcom,usb-charger" property is optional and hence may result in the usb_psy pointer being initialized to a negative ERR_PTR value. This leads to invalid pointer access in dwc3_msm_remove() when calling power_supply_put() on it. Fix this by switching to the managed variant of devm_power_supply_get_by_phandle() which allows us to simply remove the power_supply_put() call. Change-Id: I4fd1e46fd410fe143b1e499da1e9cf91dd53dd66 Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
670949a431
commit
4fc3a6ae00
1 changed files with 1 additions and 4 deletions
|
|
@ -4115,9 +4115,6 @@ static int dwc3_msm_remove(struct platform_device *pdev)
|
|||
mdwc->dpdm_nb.notifier_call = NULL;
|
||||
}
|
||||
|
||||
if (mdwc->usb_psy)
|
||||
power_supply_put(mdwc->usb_psy);
|
||||
|
||||
/*
|
||||
* In case of system suspend, pm_runtime_get_sync fails.
|
||||
* Hence turn ON the clocks manually.
|
||||
|
|
@ -4527,7 +4524,7 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned int mA)
|
|||
int ret;
|
||||
|
||||
if (!mdwc->usb_psy) {
|
||||
mdwc->usb_psy = power_supply_get_by_phandle(mdwc->dev->of_node,
|
||||
mdwc->usb_psy = devm_power_supply_get_by_phandle(mdwc->dev,
|
||||
"qcom,usb-charger");
|
||||
if (IS_ERR_OR_NULL(mdwc->usb_psy)) {
|
||||
dev_info(mdwc->dev, "Could not get usb psy\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue