[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240916211025.33zdmwz2dkpw6vl6@synopsys.com>
Date: Mon, 16 Sep 2024 21:10:19 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Roy Luo <royluo@...gle.com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"badhri@...gle.com" <badhri@...gle.com>,
"frank.wang@...k-chips.com" <frank.wang@...k-chips.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v2] usb: dwc3: re-enable runtime PM after failed resume
On Fri, Sep 13, 2024, Roy Luo wrote:
> When dwc3_resume_common() returns an error, runtime pm is left in
> suspended and disabled state in dwc3_resume(). Since the device
> is suspended, its parent devices (like the power domain or glue
> driver) could also be suspended and may have released resources
> that dwc requires. Consequently, calling dwc3_suspend_common() in
> this situation could result in attempts to access unclocked or
> unpowered registers.
> To prevent these problems, runtime PM should always be re-enabled,
> even after failed resume attempts. This ensures that
> dwc3_suspend_common() is skipped in such cases.
>
> Fixes: 68c26fe58182 ("usb: dwc3: set pm runtime active before resume common")
> Cc: stable@...r.kernel.org
> Signed-off-by: Roy Luo <royluo@...gle.com>
> ---
> drivers/usb/dwc3/core.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index ccc3895dbd7f..4bd73b5fe41b 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -2537,7 +2537,7 @@ static int dwc3_suspend(struct device *dev)
> static int dwc3_resume(struct device *dev)
> {
> struct dwc3 *dwc = dev_get_drvdata(dev);
> - int ret;
> + int ret = 0;
>
> pinctrl_pm_select_default_state(dev);
>
> @@ -2545,14 +2545,12 @@ static int dwc3_resume(struct device *dev)
> pm_runtime_set_active(dev);
>
> ret = dwc3_resume_common(dwc, PMSG_RESUME);
> - if (ret) {
> + if (ret)
> pm_runtime_set_suspended(dev);
> - return ret;
> - }
>
> pm_runtime_enable(dev);
>
> - return 0;
> + return ret;
> }
>
> static void dwc3_complete(struct device *dev)
>
> base-commit: ad618736883b8970f66af799e34007475fe33a68
> --
> 2.46.0.662.g92d0881bb0-goog
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
Thanks,
Thinh
Powered by blists - more mailing lists