[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ba84432-bd07-3e59-3638-924d5fadec30@quicinc.com>
Date: Wed, 17 Jan 2024 15:05:07 +0530
From: UTTKARSH AGGARWAL <quic_uaggarwa@...cinc.com>
To: Kuen-Han Tsai <khtsai@...gle.com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Greg Kroah-Hartman
<gregkh@...uxfoundation.org>,
<linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>
Subject: Re: [RFC PATCH] usb: dwc3: gadget: Fix NULL pointer dereference in
dwc3_gadget_suspend
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);
Powered by blists - more mailing lists