Message ID | 20210407052226.1056-1-dinghao.liu@zju.edu.cn |
---|---|
State | New |
Headers | show |
Series | usb: cdns3: Fix rumtime PM imbalance on error | expand |
On 21-04-07 13:22:26, Dinghao Liu wrote: > When cdns3_gadget_start() fails, a pairing PM usage counter > decrement is needed to keep the counter balanced. > > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> > --- > drivers/usb/cdns3/cdns3-gadget.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > index 582bfeceedb4..ad891a108aed 100644 > --- a/drivers/usb/cdns3/cdns3-gadget.c > +++ b/drivers/usb/cdns3/cdns3-gadget.c > @@ -3255,8 +3255,11 @@ static int __cdns3_gadget_init(struct cdns *cdns) > pm_runtime_get_sync(cdns->dev); > > ret = cdns3_gadget_start(cdns); > - if (ret) > + if (ret) { > + pm_runtime_mark_last_busy(cdns->dev); > + pm_runtime_put_autosuspend(cdns->dev); > return ret; It doesn't need to delay entering runtime suspend, I prefer using pm_runtime_put_sync directly. -- Thanks, Peter Chen
> On 21-04-07 13:22:26, Dinghao Liu wrote: > > When cdns3_gadget_start() fails, a pairing PM usage counter > > decrement is needed to keep the counter balanced. > > > > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> > > --- > > drivers/usb/cdns3/cdns3-gadget.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > > index 582bfeceedb4..ad891a108aed 100644 > > --- a/drivers/usb/cdns3/cdns3-gadget.c > > +++ b/drivers/usb/cdns3/cdns3-gadget.c > > @@ -3255,8 +3255,11 @@ static int __cdns3_gadget_init(struct cdns *cdns) > > pm_runtime_get_sync(cdns->dev); > > > > ret = cdns3_gadget_start(cdns); > > - if (ret) > > + if (ret) { > > + pm_runtime_mark_last_busy(cdns->dev); > > + pm_runtime_put_autosuspend(cdns->dev); > > return ret; > > It doesn't need to delay entering runtime suspend, I prefer using pm_runtime_put_sync directly. > Sounds reasonable, thanks! I will send a new patch soon. Regards, Dinghao
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index 582bfeceedb4..ad891a108aed 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -3255,8 +3255,11 @@ static int __cdns3_gadget_init(struct cdns *cdns) pm_runtime_get_sync(cdns->dev); ret = cdns3_gadget_start(cdns); - if (ret) + if (ret) { + pm_runtime_mark_last_busy(cdns->dev); + pm_runtime_put_autosuspend(cdns->dev); return ret; + } /* * Because interrupt line can be shared with other components in
When cdns3_gadget_start() fails, a pairing PM usage counter decrement is needed to keep the counter balanced. Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> --- drivers/usb/cdns3/cdns3-gadget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)