mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: UTTKARSH AGGARWAL <quic_uaggarwa@quicinc.com>
To: Kuen-Han Tsai <khtsai@google.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>
Subject: Re: [RFC PATCH] usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
Date: Wed, 17 Jan 2024 15:05:07 +0530	[thread overview]
Message-ID: <8ba84432-bd07-3e59-3638-924d5fadec30@quicinc.com> (raw)
In-Reply-To: <77ffee9a-cd77-6a09-10ee-bdf17bfca5ec@quicinc.com>


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);


  reply	other threads:[~2024-01-17  9:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10  9:55 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 [this message]
2024-01-17 12:16       ` Kuen-Han Tsai
2024-01-18  0:56       ` Thinh Nguyen
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=8ba84432-bd07-3e59-3638-924d5fadec30@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

all inboxes | Powered by JetHome®