lkml.org 
[lkml]   [2024]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH] usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
Date
On Wed, Jan 17, 2024, UTTKARSH AGGARWAL wrote:
>
> On 1/17/2024 2:52 PM, UTTKARSH AGGARWAL wrote:
> >
> > On 1/17/2024 12:47 PM, Kuen-Han Tsai wrote:
> > > >          ret = dwc3_gadget_soft_disconnect(dwc);
> > > >          if (ret)
> > > >                  goto err;
> > > For improved readability, we can remove the goto statement and move
> > > the error handling logic here.
> >
> > Hi Kuen-Han,
> >
> > Thanks for the suggestion.
> > Does this looks good to you ?
> >
> >    int ret = dwc3_gadget_soft_disconnect(dwc);if (ret) {        if
> > (dwc->softconnect)            dwc3_gadget_soft_connect(dwc);
> >
> >        return ret;    }    spin_lock_irqsave(&dwc->lock, flags);    if
> > (dwc->gadget_driver)  dwc3_disconnect_gadget(dwc);
> >  spin_unlock_irqrestore(&dwc->lock, flags);
>
> Sorry for the mistake.
>
> int ret = dwc3_gadget_soft_disconnect(dwc);
>
> if (ret) {
>
>       if (dwc->softconnect)
>
>                  dwc3_gadget_soft_connect(dwc);
>
>       return ret;
>
> }
>
> spin_lock_irqsave(&dwc->lock, flags);
>
> if (dwc->gadget_driver)
>
>        dwc3_disconnect_gadget(dwc);
>
> spin_unlock_irqrestore(&dwc->lock, flags);
>

Please only make one logical fix per change. If any unrelated refactor
or style change is needed, keep it to a separate commit.

Thanks,
Thinh
\
 
 \ /
  Last update: 2024-01-18 02:08    [W:3.184 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site