aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold2022-08-04 17:10:01 +0200
committerGreg Kroah-Hartman2022-08-18 19:33:40 +0200
commitac6928f83f8da73eee254606b45eacc6b743518a (patch)
tree39c6d290e60d2fcb845363b9babe9318ee01770c
parente3fafbd8e36530eb015a1bb31273bcf7f7035422 (diff)
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 <mka@chromium.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20220804151001.23612-10-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/dwc3/dwc3-qcom.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index b05f67d206d2..197583ff3f3d 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -959,14 +959,15 @@ static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
{
struct dwc3_qcom *qcom = dev_get_drvdata(dev);
bool wakeup = device_may_wakeup(dev);
- int ret = 0;
-
+ int ret;
ret = dwc3_qcom_suspend(qcom, wakeup);
- if (!ret)
- qcom->pm_suspended = true;
+ if (ret)
+ return ret;
- return ret;
+ qcom->pm_suspended = true;
+
+ return 0;
}
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)
int ret;
ret = dwc3_qcom_resume(qcom, wakeup);
- if (!ret)
- qcom->pm_suspended = false;
+ if (ret)
+ return ret;
- return ret;
+ qcom->pm_suspended = false;
+
+ return 0;
}
static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev)