Skip to content

Commit ac6928f

Browse files
jhovoldgregkh
authored andcommitted
usb: dwc3: qcom: clean up suspend callbacks
Clean up the suspend callbacks by separating the error and success paths to improve readability. Also drop a related redundant initialisation. Reviewed-by: Matthias Kaehlcke <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e3fafbd commit ac6928f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -959,14 +959,15 @@ static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
959959
{
960960
struct dwc3_qcom *qcom = dev_get_drvdata(dev);
961961
bool wakeup = device_may_wakeup(dev);
962-
int ret = 0;
963-
962+
int ret;
964963

965964
ret = dwc3_qcom_suspend(qcom, wakeup);
966-
if (!ret)
967-
qcom->pm_suspended = true;
965+
if (ret)
966+
return ret;
968967

969-
return ret;
968+
qcom->pm_suspended = true;
969+
970+
return 0;
970971
}
971972

972973
static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
@@ -976,10 +977,12 @@ static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
976977
int ret;
977978

978979
ret = dwc3_qcom_resume(qcom, wakeup);
979-
if (!ret)
980-
qcom->pm_suspended = false;
980+
if (ret)
981+
return ret;
981982

982-
return ret;
983+
qcom->pm_suspended = false;
984+
985+
return 0;
983986
}
984987

985988
static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev)

0 commit comments

Comments
 (0)