Re: [PATCH] usb: chipidea: get lock before calling usb_[disable|enable]_autosuspend()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21-08-05 11:58:59, Greg Kroah-Hartman wrote:
> On Wed, Aug 04, 2021 at 09:38:09AM +0800, Peter Chen wrote:
> > On 21-08-02 22:52:12, Salah Triki wrote:
> > > Based on the documentation of usb_[disable|enable]_autosuspend(), the
> > > caller must hold udev's device lock.
> > > 
> > > Signed-off-by: Salah Triki <salah.triki@xxxxxxxxx>
> > > ---
> > >  drivers/usb/chipidea/otg_fsm.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> > > index 6ed4b00dba96..2d4174250432 100644
> > > --- a/drivers/usb/chipidea/otg_fsm.c
> > > +++ b/drivers/usb/chipidea/otg_fsm.c
> > > @@ -518,12 +518,14 @@ static void ci_otg_loc_sof(struct otg_fsm *fsm, int on)
> > >  	if (!udev)
> > >  		return;
> > >  
> > > +	usb_lock_device(udev);
> > >  	if (on) {
> > >  		usb_disable_autosuspend(udev);
> > >  	} else {
> > >  		pm_runtime_set_autosuspend_delay(&udev->dev, 0);
> > >  		usb_enable_autosuspend(udev);
> > >  	}
> > > +	usb_unlock_device(udev);
> > >  }
> > >  
> > 
> > Acked-by: Peter Chen <peter.chen@xxxxxxxxxx>
> 
> I think this is not ok, see the other threads...

Thanks for checking it, I read Alan's comments for the similar patches.
Yes, it doesn't need since all callers have already holds fsm->lock.

-- 

Thanks,
Peter Chen




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux