Commit 9a8ad10c authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: dwc3: fix runtime pm imbalance on probe errors

Make sure not to suspend the device when probe fails to avoid disabling
clocks and phys multiple times.

Fixes: 32808237 ("usb: dwc3: fix runtime PM in error path")
Cc: stable@vger.kernel.org      # 4.8
Cc: Roger Quadros <rogerq@ti.com>
Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20230404072524.19014-2-johan+linaro@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21d018b7
...@@ -1895,13 +1895,11 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -1895,13 +1895,11 @@ static int dwc3_probe(struct platform_device *pdev)
spin_lock_init(&dwc->lock); spin_lock_init(&dwc->lock);
mutex_init(&dwc->mutex); mutex_init(&dwc->mutex);
pm_runtime_get_noresume(dev);
pm_runtime_set_active(dev); pm_runtime_set_active(dev);
pm_runtime_use_autosuspend(dev); pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY); pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY);
pm_runtime_enable(dev); pm_runtime_enable(dev);
ret = pm_runtime_get_sync(dev);
if (ret < 0)
goto err1;
pm_runtime_forbid(dev); pm_runtime_forbid(dev);
...@@ -1966,12 +1964,10 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -1966,12 +1964,10 @@ static int dwc3_probe(struct platform_device *pdev)
dwc3_free_event_buffers(dwc); dwc3_free_event_buffers(dwc);
err2: err2:
pm_runtime_allow(&pdev->dev); pm_runtime_allow(dev);
pm_runtime_disable(dev);
err1: pm_runtime_set_suspended(dev);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_noidle(dev);
pm_runtime_disable(&pdev->dev);
disable_clks: disable_clks:
dwc3_clk_disable(dwc); dwc3_clk_disable(dwc);
assert_reset: assert_reset:
......
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