From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: UTTKARSH AGGARWAL <quic_uaggarwa@quicinc.com>
Cc: Kuen-Han Tsai <khtsai@google.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [RFC PATCH] usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
Date: Thu, 18 Jan 2024 00:56:43 +0000 [thread overview]
Message-ID: <20240118005641.fpydq2opopbmlnvj@synopsys.com> (raw)
In-Reply-To: <8ba84432-bd07-3e59-3638-924d5fadec30@quicinc.com>
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
next prev parent reply other threads:[~2024-01-18 0:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 9:55 [RFC PATCH] usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend Uttkarsh Aggarwal
2024-01-17 1:19 ` Thinh Nguyen
2024-01-17 6:36 ` UTTKARSH AGGARWAL
2024-01-17 6:49 ` Kuen-Han Tsai
2024-01-17 7:17 ` Kuen-Han Tsai
2024-01-17 9:22 ` UTTKARSH AGGARWAL
2024-01-17 9:35 ` UTTKARSH AGGARWAL
2024-01-17 12:16 ` Kuen-Han Tsai
2024-01-18 0:56 ` Thinh Nguyen [this message]
2024-01-18 8:46 ` UTTKARSH AGGARWAL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240118005641.fpydq2opopbmlnvj@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=khtsai@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_uaggarwa@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox