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

Commit cc7fdb06 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3-msm: don't enable runtime PM until probe finishes



If pm_runtime_enable() is called in the middle of probe(),
and it still has yet to initialize child devices, there
could be a race between when the parent's child_count is
incremented and when the RPM worker thread decides to place
the parent device into idle/suspend. This could cause a NULL
pointer dereference as the hs_phy member is not initialized,
yet dwc3_msm_suspend() is already being called.

Fix this by not calling pm_runtime_set_active/enable until
the end of probe, effectively disabling runtime PM until
everything has initialized.

Change-Id: Icf184789f0e3722e7901615a9d37dc3dd6950394
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 0cabfa0f
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -2501,9 +2501,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)


	mdwc->io_res = res; /* used to calculate chg block offset */
	mdwc->io_res = res; /* used to calculate chg block offset */


	pm_runtime_set_active(mdwc->dev);
	pm_runtime_enable(mdwc->dev);

	if (of_property_read_u32(node, "qcom,dwc-usb3-msm-dbm-eps",
	if (of_property_read_u32(node, "qcom,dwc-usb3-msm-dbm-eps",
				 &mdwc->dbm_num_eps)) {
				 &mdwc->dbm_num_eps)) {
		dev_err(&pdev->dev,
		dev_err(&pdev->dev,
@@ -2680,6 +2677,9 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	pm_stay_awake(mdwc->dev);
	pm_stay_awake(mdwc->dev);
	dwc3_msm_debugfs_init(mdwc);
	dwc3_msm_debugfs_init(mdwc);


	pm_runtime_set_active(mdwc->dev);
	pm_runtime_enable(mdwc->dev);

	return 0;
	return 0;


put_dwc3:
put_dwc3: