From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22EBFC7EE24 for ; Sat, 6 May 2023 05:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjEFFxm (ORCPT ); Sat, 6 May 2023 01:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbjEFFxl (ORCPT ); Sat, 6 May 2023 01:53:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 658A549EC for ; Fri, 5 May 2023 22:53:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED91E6150F for ; Sat, 6 May 2023 05:53:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56935C433D2; Sat, 6 May 2023 05:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683352419; bh=iMhvU/h6YWakAPglrb2dPXI/8AxkU9Qb8ObP8DxKHf8=; h=Subject:To:Cc:From:Date:From; b=of0wGYQADzJw8ePcfGtjbaWLH4iueVY/tTfMqBg1teDmG71pjUeLedHrkG2EJ+RqE CCPq7VUrD9IvzH/Ui7odic6Ss1R7XXdiZ7V1Ml+sF/GFyxnZhZ10AHH+J9skctqmRK z7lv70BAMO4c+yC0XkLDZTgOrTUqdat7abxqJLEM= Subject: FAILED: patch "[PATCH] usb: gadget: udc: core: Prevent redundant calls to pullup" failed to apply to 5.15-stable tree To: badhri@google.com, gregkh@linuxfoundation.org Cc: From: Date: Sat, 06 May 2023 10:48:27 +0900 Message-ID: <2023050627-paternal-recollect-4f44@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x a3afbf5cc887fc3401f012fe629810998ed61859 # git commit -s git send-email --to '' --in-reply-to '2023050627-paternal-recollect-4f44@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From a3afbf5cc887fc3401f012fe629810998ed61859 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Fri, 7 Apr 2023 03:07:41 +0000 Subject: [PATCH] usb: gadget: udc: core: Prevent redundant calls to pullup usb_gadget_connect calls gadget->ops->pullup without checking whether gadget->connected was previously set. Make this symmetric to usb_gadget_disconnect by returning early if gadget->connected is already set. Fixes: 5a1da544e572 ("usb: gadget: core: do not try to disconnect gadget if it is not connected") Cc: stable@vger.kernel.org Signed-off-by: Badhri Jagan Sridharan Link: https://lore.kernel.org/r/20230407030741.3163220-2-badhri@google.com Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index af92c2e8e10c..1c5403ce9e7c 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -703,6 +703,9 @@ static int usb_gadget_connect_locked(struct usb_gadget *gadget) goto out; } + if (gadget->connected) + goto out; + if (gadget->deactivated || !gadget->udc->started) { /* * If gadget is deactivated we only save new state.