Re: [PATCH] usb: dwc3: gadget: remove warning during kernel boot

Ray Chi
2024-02-20T09:43:34Z

Hi Krishna,

I verified the Thinh's patch and the warning could be
fixed. Thanks for the information.

Regards,
Ray

On Tue, Feb 20, 2024 at 4:40 PM Krishna Kurapati PSSNV
<quic_kriskura@quicinc.com> wrote:
>
>
>
> On 2/20/2024 2:04 PM, Greg KH wrote:
> > On Tue, Feb 20, 2024 at 04:12:04PM +0800, Ray Chi wrote:
> >> The dwc3->gadget_driver is not initialized during the dwc3 probe
> >> process. This leads to a warning when the runtime power management (PM)
> >> attempts to suspend the gadget using dwc3_gadget_suspend().
> >
> > What type of warning happens?
> >
> >> This patch adds a check to prevent the warning.
> >>
> >> Cc: stable@vger.kernel.org
> >> Fixes: 61a348857e86 ("usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend")
> >> Signed-off-by: Ray Chi <raychi@google.com>
> >> ---
> >> drivers/usb/dwc3/gadget.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> >> index 28f49400f3e8..de987cffe1ec 100644
> >> --- a/drivers/usb/dwc3/gadget.c
> >> +++ b/drivers/usb/dwc3/gadget.c
> >> @@ -4708,6 +4708,9 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)
> >> unsigned long flags;
> >> int ret;
> >>
> >> + if (!dwc->gadget_driver)
> >> + return 0;
> >> +
> >
> > This directly reverts part of the commit you say this fixes, are you
> > SURE about this? Why?
> >
>
> Hi Ray,
>
> Thinh sent a patch recently addressing the issue in soft disconnect.
> Can you check if it helps:
>
> https://lore.kernel.org/all/e3be9b929934e0680a6f4b8f6eb11b18ae9c7e07.1708043922.git.Thinh.Nguyen@synopsys.com/
>
> Regards,
> Krishna,