public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Ray Chi <raychi@google.com>
To: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org,
	 quic_uaggarwa@quicinc.com
Cc: albertccwang@google.com, linux-usb@vger.kernel.org,
	 linux-kernel@vger.kernel.org, Ray Chi <raychi@google.com>,
	stable@vger.kernel.org
Subject: [PATCH] usb: dwc3: gadget: remove warning during kernel boot
Date: Tue, 20 Feb 2024 16:12:04 +0800	[thread overview]
Message-ID: <20240220081205.135063-1-raychi@google.com> (raw)

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().

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;
+
 	ret = dwc3_gadget_soft_disconnect(dwc);
 	if (ret)
 		goto err;
-- 
2.44.0.rc0.258.g7320e95886-goog


             reply	other threads:[~2024-02-20  8:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20  8:12 Ray Chi [this message]
2024-02-20  8:20 ` [PATCH] usb: dwc3: gadget: remove warning during kernel boot Ray Chi
2024-02-20  8:39   ` Greg KH
2024-02-20  8:34 ` Greg KH
2024-02-20  8:40   ` Krishna Kurapati PSSNV
2024-02-20  9:42     ` Ray Chi
2024-02-20 13:56       ` Greg KH
2024-02-23 10:36         ` Ray Chi

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=20240220081205.135063-1-raychi@google.com \
    --to=raychi@google.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=albertccwang@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_uaggarwa@quicinc.com \
    --cc=stable@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