Skip to content

Commit

Permalink
usb: dwc3: xilinx: improve error handling for PM APIs
Browse files Browse the repository at this point in the history
Improve error handling for PM APIs in the dwc3_xlnx_probe function by
introducing devm_pm_runtime_enable and error label. Removed unnecessary
API pm_runtime_disable call in dwc3_xlnx_remove.

Signed-off-by: Piyush Mehta <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
PiyushXilinx authored and gregkh committed Dec 15, 2023
1 parent 5192020 commit 53b5ff8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/usb/dwc3/dwc3-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,15 @@ static int dwc3_xlnx_probe(struct platform_device *pdev)
goto err_clk_put;

pm_runtime_set_active(dev);
pm_runtime_enable(dev);
ret = devm_pm_runtime_enable(dev);
if (ret < 0)
goto err_pm_set_suspended;

pm_suspend_ignore_children(dev, false);
pm_runtime_get_sync(dev);
return pm_runtime_resume_and_get(dev);

return 0;
err_pm_set_suspended:
pm_runtime_set_suspended(dev);

err_clk_put:
clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks);
Expand All @@ -315,7 +319,6 @@ static void dwc3_xlnx_remove(struct platform_device *pdev)
clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks);
priv_data->num_clocks = 0;

pm_runtime_disable(dev);
pm_runtime_put_noidle(dev);
pm_runtime_set_suspended(dev);
}
Expand Down

0 comments on commit 53b5ff8

Please sign in to comment.