Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84e8cc8c authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3-msm: Unregister bus client upon removal



If probe fails or the platform device is removed, make sure
to unregister the msm_bus_scale client. Otherwise it could
cause the bus driver to access a dangling pointer.

Change-Id: I9eec53d5104cf72c9fdc731cf1bbb5062fe5beb7
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 07692d57
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3224,6 +3224,8 @@ static int dwc3_msm_probe(struct platform_device *pdev)

put_dwc3:
	platform_device_put(mdwc->dwc3);
	if (mdwc->bus_perf_client)
		msm_bus_scale_unregister_client(mdwc->bus_perf_client);
disable_vbus:
	if (!IS_ERR_OR_NULL(mdwc->vbus_otg))
		regulator_disable(mdwc->vbus_otg);
@@ -3306,6 +3308,9 @@ static int dwc3_msm_remove(struct platform_device *pdev)
	pm_runtime_set_suspended(mdwc->dev);
	device_wakeup_disable(mdwc->dev);

	if (mdwc->bus_perf_client)
		msm_bus_scale_unregister_client(mdwc->bus_perf_client);

	if (!IS_ERR_OR_NULL(mdwc->vbus_otg))
		regulator_disable(mdwc->vbus_otg);