From patchwork Tue Feb 20 08:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Chi X-Patchwork-Id: 203473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp256689dyc; Tue, 20 Feb 2024 00:12:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVoeO9LOpDWut14AP40YJfbcFn+q80gRqdp8ZuujzGf1sA6Z345JKDPny19JNveHGGizS/Vw/mcDA3h07I32Et6fkGndw== X-Google-Smtp-Source: AGHT+IG8Z3koTcoo3Qhv1Ji9KIOWGP3z82jdqrG5A21nc62qCmpWZHyyL8uvwDyUw2O7qeYQtVbC X-Received: by 2002:aa7:c61a:0:b0:564:7087:e3d with SMTP id h26-20020aa7c61a000000b0056470870e3dmr3436402edq.14.1708416773332; Tue, 20 Feb 2024 00:12:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708416773; cv=pass; d=google.com; s=arc-20160816; b=Z9bELo383Ser+EjieQnRWYs/6fMfSaB2Z88QAJe2z3cIGO44L6BzStKCZ2QrGhKrMp w6rZW9NB1p+CR0aqm+NIdfS3KN0Jv6KQeAm4gS/uARdLu2mcsCeZSY2LA0yTHEXXSuSZ P6rltKFIbjxgPVJFcDTZ6Py8b6DqczZIvHlYk/+Y0w5GTdmk8fVkD63pEs3z7Vx9w8Rn dHJRJm6137nJmIx8V7GHSIym7M00865qYDKj2dqsKVLhSO/tTla2qPsDGrCiT9NvQtTq ueJJwmxgDAWox/JkjkZsXlTVtVXkRxem+833yWuLIE074UUtaYLS0VyKCbKCQ5KtX0wT qWAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=7NyTQc14Zf/h2SqeLHUekdRb34OTt1i2UvuEmj+OuFE=; fh=L0+VBNu7NpNv63eUqAiAB4XuAVEA6kp+twFw36xxoL0=; b=q36rQJSbUd1jABia9j/QArq20yGuVdceTXMKASCocgCcKQ3Gg0OOiss1Ts7I3CniI+ fMV/0qbtMGBESwny5keqrKw920XVvLiEpIt65QWzA95F63bhns1BFamrpksCjbz6dKv9 tUZ9+9jmUZRmUDV4OyryJ/yE7sBh4bw7sX8KY1OLPWqiPzYKGvnPUXXDjcMJcjDafWpA vH81TsVv0pqFKJmiKmoi60tEWVry/LFbHZ18bFFdn2BMVHlnEhZJND5Tt2AaEy+Khqlj yYO9B6XnmBW0PO0bzPyABfWaClvbcdQwh3WpPB4lGvAkqKY0zbYxXPsGesLaFnipaE3i XU7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=g+nggSxm; arc=pass (i=1 spf=pass spfdomain=flex--raychi.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-72517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n8-20020a05640206c800b00563f221dfb6si3281913edy.278.2024.02.20.00.12.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 00:12:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=g+nggSxm; arc=pass (i=1 spf=pass spfdomain=flex--raychi.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-72517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EDD771F21EC8 for ; Tue, 20 Feb 2024 08:12:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A79C65CDE0; Tue, 20 Feb 2024 08:12:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g+nggSxm" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90F965C5EC for ; Tue, 20 Feb 2024 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708416739; cv=none; b=YahD4WEHXOp8pvZUTb6wofmwyWGGD27JCiwlM3iT4OYhpNxi9bLi5s3zbeATWGsYWLwjqKkhRnrgUPObxM1AUM/E+MJCYB7mxEvoSUuqTiIZ+teLC8HgnZUzQs5EE1IB1wFccuvCLlp7mX71Q4mtA7dMcFDnrV+q0SUPCH/Tz3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708416739; c=relaxed/simple; bh=/rabM4Ojv3qXPABWhPOzcXvWzcE1bpcBe1707Z9xKgg=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=VdD7HBzFQXiw1nQeYsUYd5hboBG7Q/tZTeCn/8oaz+Cm+FngrS/Qo3sJPcKoaE2uULGdeAXQ+UuDgoGY2z9R6/ddgjL7hkkrdYtn7JtLsWOtsAza6QsaxRIOUkisnclnOgQjntvKTwiNujptKKJrkhKMOid4U5dmLVMCzFRF/Vs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--raychi.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=g+nggSxm; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--raychi.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc743cc50a6so6911642276.2 for ; Tue, 20 Feb 2024 00:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708416736; x=1709021536; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=7NyTQc14Zf/h2SqeLHUekdRb34OTt1i2UvuEmj+OuFE=; b=g+nggSxmQkbCXvjQQMjfd+GJrhqjetnwR3vH3J7tBDV3Mki9t9r4v1QDZnCPz5OK88 kG6dQSYSd73EVxG6bae7vMB7ZAP+fbZanubSs/NaF8qvgLPygjoSgLLS+ZUhO+TC3zy6 lvYQcIoD1oYrhwiyo6s2bNb9OQ8/J7BgLzwxBN/iFSoax/63sS82m6waRJSSYe26oOp0 c6DlUqQYAQEllT78ObvQYJg7nN5+WCor/I4P62AVuztaruIblbXmezvm6tTFkJlwmnzL DKyZW8x2J1vf+gOCdsx8h7krEexg/qz7i0R7bc9C29X9FUOcw8j4Qzg6iR+kmJ0iYi3x JpDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708416736; x=1709021536; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=7NyTQc14Zf/h2SqeLHUekdRb34OTt1i2UvuEmj+OuFE=; b=r8uyVOXMfoj1xkbV/1wT9e2IllauyDcXDRlDeotzN7jNqRUpYvtlJxrl6KQDFfk9/J bazAUnvk3gLxYBhUFpPpnIQMuLgNxfkMQULLX6NRd9NH6w8LhUKpIHltxtPd81DBzO4d XZ55GXD1gE0qDEl2Wo3XwUESL6dXmWhaPxiHaK3I2yCWLV35wR0WIO2wqOS6hI45BEHt vC5w4sT7wK6ffjdIXTYedpP0m0jMmYg4IQOMIgANDM7qCmKAsSK2U+LhCgkUV2Bda++b StPA7JFk/EKiLFtd8pLWY/QnKActsMeJDzHZA746+WkKPNM8cOAAOZska3YCUqine1hX Q/BA== X-Forwarded-Encrypted: i=1; AJvYcCWxbrrK3b0RU/DJ8RW7sFVpnXrToKZKpv6dPeUYjhfNAFIBE7X1xk+zncxvsZUpAyvRp8FgEHfZeWH0ZD/R+0ICq5yw1X8w/os6dQjy X-Gm-Message-State: AOJu0YzaWyb+tnyysgIIUTgGIgI2kqM/TB7ZO+lNqevsi79qpTHepICZ ubN3JFb5To68KojppsRawlB/EZidzAqJKt4ZSLdDvis3chXgqKacURC/+/qK6rUA3I6N8+ukTQm ljQ== X-Received: from raychi-p620lin01.ntc.corp.google.com ([2401:fa00:fc:202:d899:e5b8:ba5f:3c9]) (user=raychi job=sendgmr) by 2002:a25:abec:0:b0:dcc:94b7:a7a3 with SMTP id v99-20020a25abec000000b00dcc94b7a7a3mr495450ybi.12.1708416736722; Tue, 20 Feb 2024 00:12:16 -0800 (PST) Date: Tue, 20 Feb 2024 16:12:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240220081205.135063-1-raychi@google.com> Subject: [PATCH] usb: dwc3: gadget: remove warning during kernel boot From: Ray Chi 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 , stable@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791404826764627827 X-GMAIL-MSGID: 1791404826764627827 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 --- 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;