usb: chipidea: tegra: disable runtime PM on resume failure
Subsystems (4)
PATCH 1/1 usb: chipidea: tegra: disable runtime PM on resume failure
tegra_usb_probe() enables runtime PM before resuming the device. If pm_runtime_resume_and_get() fails, probe returns without disabling runtime PM. The later error paths reach pm_runtime_force_suspend(), but this early return bypasses that cleanup.
Disable runtime PM before returning the resume error. Do not use the fail_power_off path: the failed resume did not retain a usage reference, so its pm_runtime_put_sync_suspend() would be unbalanced.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/usb/chipidea/ci_hdrc_tegra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/chipidea/ci_hdrc_tegra.c +3 -1
@@ -306,8 +306,10 @@ static int tegra_usb_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); err =pm_runtime_resume_and_get (&pdev->dev); -if (err) +if (err) { +pm_runtime_disable (&pdev->dev);return err; + }if (device_property_present (&pdev->dev,"nvidia,needs-double-reset" )) usb->needs_double_reset = true;
Quoted 12 lines · Myeonghun Pak
tegra_usb_probe()enables runtime PM before resuming the device. Ifpm_runtime_resume_and_get()fails, probe returns without disabling runtime PM. The later error paths reachpm_runtime_force_suspend(), but this early return bypasses that cleanup.Disable runtime PM before returning the resume error. Do not use the
fail_power_offpath: the failed resume did not retain a usage reference, so itspm_runtime_put_sync_suspend()would be unbalanced.This issue was identified during our ongoing static-analysis research while reviewing kernel code.
Quoted 6 lines
Fixes 8b85e11c1a7a ("usb: chipidea: tegra: Add runtime PM and OPP support")Assisted-by OpenAI:GPT-5.6Co-developed-by Ijae Kim <[email protected]>Signed-off-by Ijae Kim <[email protected]>Signed-off-by Myeonghun Pak <[email protected]>
Peter
Quoted 20 lines
--- drivers/usb/chipidea/ci_hdrc_tegra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/usb/chipidea/ci_hdrc_tegra.c +3
-1@@ -306,8 +306,10 @@ static int tegra_usb_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); err =pm_runtime_resume_and_get (&pdev->dev); -if (err) +if (err) { +pm_runtime_disable (&pdev->dev);return err; + }if (device_property_present (&pdev->dev,"nvidia,needs-double-reset" )) usb->needs_double_reset = true;
Signature · 2 lines
Thanks, Peter Chen