public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: UTTKARSH AGGARWAL <quic_uaggarwa@quicinc.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Kuen-Han Tsai <khtsai@google.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 14:16:11 +0530	[thread overview]
Message-ID: <0ef3fb11-a207-2db4-1714-b3bca2ce2cea@quicinc.com> (raw)
In-Reply-To: <20240118005641.fpydq2opopbmlnvj@synopsys.com>


On 1/18/2024 6:26 AM, Thinh Nguyen wrote:
> 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

Sure Thinh,I’ll only push fix in v2, not refactoring.

Thanks,

Uttkarsh


      reply	other threads:[~2024-01-18  8:46 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
2024-01-18  8:46         ` UTTKARSH AGGARWAL [this message]

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=0ef3fb11-a207-2db4-1714-b3bca2ce2cea@quicinc.com \
    --to=quic_uaggarwa@quicinc.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=khtsai@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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