Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20132130rwd; Wed, 28 Jun 2023 20:47:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7g/XO/Lgpi6dRKVt/zuvU10Uf1vdQ2lgaE7t/qobS1xZyz+37QRVDkD/3PKzuNJhlEUNmg X-Received: by 2002:a9d:7389:0:b0:6b7:155b:1df8 with SMTP id j9-20020a9d7389000000b006b7155b1df8mr21035894otk.16.1688010431555; Wed, 28 Jun 2023 20:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688010431; cv=none; d=google.com; s=arc-20160816; b=hDYX0i+6lukgG/D4yJOCz7G637wX6HbnJ9271xZehxlSsyzbPGgCtJV7SFWFIGMnkE odRjVr5iOjn9KoUh5NGats1AHDU9KfYGroynEW2o9R0NLipFc9jllVDPwn0MMCqwYLMH dcRNK5KTSZRBxeMytnL1X0sJ1ABAvrMYAUYgns6HFY7foDbaCM9ggKgXrlBNrN/PfhDC CsIH/3OCq6Eb13quM8tEfVNcTYYFBF/KOxn4alx9kVSvwk6E/xGaLG4os7lw3UycZaVJ idcCtNJ5XDs5i1nKzrkbyGU9G3xV7mVrC9jTdwzliWd6yp0uKmxrSiCkv8Ke/MMDburG AGYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=WJJRbDtWJJLMKTpDJXyqFIZo7Y11r56fJ2PjPtP8avk=; fh=43ZHsOHadYzFViTMqwum1f1huZVx6MBjsu0wYKz01vA=; b=n6skfCu39jSVdZfnVmLcVsxr2hTjlir29a95rXZkYV3UejpXjByTlFf2uuoQpza2F5 73KizHZX1Z7g674/TOBJ767SSxmAbjj4rthWtsRK8pLABkWg6jYHwLjWSZCPWXm3pazZ MiF25Bdc3VCZ2dnxzXv8/YP6d3rOiaZAU5+SlJUeVYBRnldJC7ekHotMTFDj4GT3/RpA RNh9FFVkgI1ALjbx4brF0vrXjHqW0lWQjfh253WTY464O6y0vGKQFsHC4jpvr2L+zoSU rkL7gXts7PV3me/Kv8Msgf/l9DuRDnovu0USmFRV3mEGssADmeSBqWu5pwipATCOAjYt zbgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfRidV3o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 16-20020a631150000000b005346b8dae84si10224406pgr.787.2023.06.28.20.46.59; Wed, 28 Jun 2023 20:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfRidV3o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbjF2DXb (ORCPT + 99 others); Wed, 28 Jun 2023 23:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbjF2DXX (ORCPT ); Wed, 28 Jun 2023 23:23:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1E062713; Wed, 28 Jun 2023 20:23:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C34E61469; Thu, 29 Jun 2023 03:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B51F4C433C0; Thu, 29 Jun 2023 03:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688009001; bh=jPUDoa5cZUOVLW9fXcJjrHQ4e1B4ZzR+5PdHRs1Dzio=; h=Date:Subject:To:References:From:In-Reply-To:From; b=VfRidV3ovcBlqprFPTQzhiyN6hq8PWpDbgXhFNU58toQVUOLqNeKHB40Vv+xw58Fd a+J2LRnQRj/3ES1P0xPw7VpB810jbOXajlgRxlDRw5Gy+QoO6dZi+spC7fBWJgliXM dW1YYR86KQgOPooV+VSkUU6NjdQJlDatxPYotyFrBZUrI6Em++lU9T8PjSL4QmKGk7 WuuUWm5yq8+Zdtt8N/SqpChNEc1aZ47Q0IRpFnp751NmE0/hNxHv8QGk5lm3xuNWCK o+H10V2l51UJjUtHiL2Xwd/HcQX7IBEkoEn8MG3ARygL/kC14ketAVNxfTOo5kY1qv 9FrtNRY1nUpQg== Message-ID: <42940cae-ce4f-577a-474b-f06b3b481e4e@kernel.org> Date: Thu, 29 Jun 2023 08:53:14 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability To: Frank Li , r-gunasekaran@ti.com, imx@lists.linux.dev, jun.li@nxp.com, Greg Kroah-Hartman , Elson Roy Serrao , Thinh Nguyen , Andy Shevchenko , =?UTF-8?B?SsOzIMOBZ2lsYSBCaXRzY2g=?= , Prashanth K , Peter Chen , "open list:USB SUBSYSTEM" , open list References: <20230628222437.3188441-1-Frank.Li@nxp.com> Content-Language: en-US From: Roger Quadros In-Reply-To: <20230628222437.3188441-1-Frank.Li@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/06/2023 03:54, Frank Li wrote: > The legacy gadget driver omitted calling usb_gadget_check_config() > to ensure that the USB device controller (UDC) has adequate resources, > including sufficient endpoint numbers and types, to support the given > configuration. > > Previously, usb_add_config() was solely invoked by the legacy gadget > driver. Adds the necessary usb_gadget_check_config() after the bind() > operation to fix the issue. You have only fixed composite.c. Not all gadget drivers use composite.c so it will be still broken for them. Please also add default sane configuration in CDNS3 so it works even if usb_gadget_check_config() is not invoked. > > Fixes: dce49449e04f ("usb: cdns3: allocate TX FIFO size according to composite EP number") > Reported-by: Ravi Gunasekaran > Signed-off-by: Frank Li > --- > drivers/usb/gadget/composite.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > index 1b3489149e5e..dd9b90481b4c 100644 > --- a/drivers/usb/gadget/composite.c > +++ b/drivers/usb/gadget/composite.c > @@ -1125,6 +1125,10 @@ int usb_add_config(struct usb_composite_dev *cdev, > goto done; > > status = bind(config); > + > + if (status == 0) > + status = usb_gadget_check_config(cdev->gadget); > + > if (status < 0) { > while (!list_empty(&config->functions)) { > struct usb_function *f; -- cheers, -roger