Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19867672rwd; Wed, 28 Jun 2023 15:52:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ou3MdmjrMdjTMCheJ/xuiGKXGV3w2BSSkdiKEVfC1S5XbbN0V5dci7zlhC5jSaWAbAyxz X-Received: by 2002:a05:6a21:6811:b0:ff:8d85:9f24 with SMTP id wr17-20020a056a21681100b000ff8d859f24mr27413098pzb.50.1687992747931; Wed, 28 Jun 2023 15:52:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687992747; cv=pass; d=google.com; s=arc-20160816; b=sDj7e6IL23180Y/4b3ppMxWYKxTFEvZ8uTTcxKHtHx2W43rwM8GPTjapPKbMYzItfh UNRbH6WIvtEn4gURkpweoD5fO/iu/80Dqj1EyMrUxh9bw9cdYSvvIHBdJu3P+ZDL/aEn fXnY4mvzl7RnpvddstXuWTR2D9q9M96ILsStXltulhybsERZ5h4QpvRQl3u1psn8aRSP Q0h3eUrPgUKyJCX1+xp5sxfEQWz+D07Qi/dmXoiBbL1ixManeHsNLsWQFm7SxQ+W4PFR eMC1LLi3FjTj4nnGUm/1F95eDk2zsajE8tix4LrB79MapT3Q301WPvyVxRR1ON1K7pao hB/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:to:from:dkim-signature; bh=k9MJqgXQBKH9p6GXj7nxHl/BRBNIsFl4yA15DxmnC7Q=; fh=/TMYo7VS9RGOhQpbi7DF/jrBW/8PbZv/kE9M1+91vkk=; b=Q5DGRyJ/n8ZnE6ZiOeNvEa1Mn9TebGUZcsNfksJh7T5R8hsg5/BlVqKuzHj7QYu6WX xXxxe3vopH3kNE9S+uWXEsbR1cXqO9H3wVX8HWFPypp05bsAMwfV+LJKmh/6WVRLCyRJ tn035s9qjE2pysHeue7/ZVCUdJPvuBeOpLwVo3s5MD/u6O3VzXxyUEiBA8nTjo9dnbbf LG6LJGOkPMKucAh71P1iL/tMObAZhfqrsADb8LUKdZpPPf2QwIZ+GX2jtZqg1qhLUMW1 riS0lEXWU57Wq9UmOZuuWvB+KiB2WKugVL2Y89dmv/TvmK7VuK7T+SpbiyixX2+SXMUH PGqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="EpYEd/az"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 200-20020a6219d1000000b00665dfbf3b17si9156326pfz.264.2023.06.28.15.52.13; Wed, 28 Jun 2023 15:52:27 -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=@nxp.com header.s=selector2 header.b="EpYEd/az"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbjF1WZA (ORCPT + 99 others); Wed, 28 Jun 2023 18:25:00 -0400 Received: from mail-db5eur02on2071.outbound.protection.outlook.com ([40.107.249.71]:3265 "EHLO EUR02-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231300AbjF1WY6 (ORCPT ); Wed, 28 Jun 2023 18:24:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpwnuLpMD0v3APyu5jzeBFW4z9wFlw1HXLusPrtL+u34Omhi3J7EF6cZISBmMVTt9yF/pFTDe8Q7N4ksIrgZhxo7H+Lb3p+tBseYCY4ChRDB+3jVrUkf3TDiNZQRBXFR/zyzttt6q4F/RbbWyHUG4ok4CdEdPEg5B4x0x8IO7opaLOIUeBm5JiElojw1ihQfHeknJhzqYQmPGePKqiC5Jf3twNjlucVTqE6toYC4B69Q/jfhFChe91WzX3MwoMuxr1O0+WlTor7XuFcfvjBABoRfBSo23O+o2Ad04HxfKQfbMwPUf9mVRdR7Uf4AkLVGXrlwjoyFXJkGIrvV6CIslg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k9MJqgXQBKH9p6GXj7nxHl/BRBNIsFl4yA15DxmnC7Q=; b=Eah04OFZXS7t+7SzgSyi/WNkELY/dKWywVJ8ryNQSSIth8+qtOqTsj4UHeB+W1O5maHiiP2TjjMDZV/XpeGH7IyXPeUf7ZzYz+KtMol6iG+Bj6aObvFh2HLVEv3Oe5WBg/M3M69g88wmfX4ssraj9Q3j3AMN9LX5eibDGc5tXN9rqcHcq8gbr30fnt0xMRHspaUi00tZ6NXXasDLxhdrMuvVcUNVmcjLEOFibcGbedb45a7ugHKYe/f+sJJvhdWb4Lp0cRnqOKGWNvJu3FKK9WP4oP4l4UO2DEQgKbfE4Qf647OTFcgHflRAO0IOl71L4mjo6fzhPSHBLimlYUrHHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k9MJqgXQBKH9p6GXj7nxHl/BRBNIsFl4yA15DxmnC7Q=; b=EpYEd/azGYEoOeOAT4yp3nB62n6XaiX44eAh3Q5j5cH3tTpPhXMUUsEb37lk1H0byptjb3D83Y5Ng+yg4bKLdAHo/QIpNxiwMCqKGS3a+U4KQXiBxCS8IUBLghCxmqn2rhDo/rvPV9wLiQrP33rBwDj6nLrjZbOYrJxcRdgetb0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by VI1PR04MB9978.eurprd04.prod.outlook.com (2603:10a6:800:1d7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Wed, 28 Jun 2023 22:24:54 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6521.026; Wed, 28 Jun 2023 22:24:54 +0000 From: Frank Li To: rogerq@kernel.org, r-gunasekaran@ti.com, imx@lists.linux.dev, jun.li@nxp.com, Greg Kroah-Hartman , Elson Roy Serrao , Thinh Nguyen , Andy Shevchenko , =?UTF-8?q?J=C3=B3=20=C3=81gila=20Bitsch?= , Prashanth K , Peter Chen , linux-usb@vger.kernel.org (open list:USB SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability Date: Wed, 28 Jun 2023 18:24:36 -0400 Message-Id: <20230628222437.3188441-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0036.namprd13.prod.outlook.com (2603:10b6:a03:2c2::11) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9978:EE_ X-MS-Office365-Filtering-Correlation-Id: 86813297-e0c0-4536-4c10-08db78267ee9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H0XUWOr+MXgUFfX0TvTs5FsOl3TUVevWSTFef5zZPsjL5fZZwruDitAA8iI3BOvbCVu1+sNHigCxtzmZyFGt+iB5bo/ltzWg0kw2snEeJOqhqZoHtbPX9OhJEsp0m+BtZpWK3pUMFUiPTTMP0JlqIDVGWkK7IirV/wrfLjVARgCYSiUjeLfUNL0mei0liELxNXob7MvIV0mwDE+X4tr/SLS9JQW4+FemQdvMRoN8G/K0+qg5iAxaQ+lvMbuDbc70R/SpHLIbPvhom3eij62HxWIKodLGG5oQlZFmSxAGI1S+4rtQ9IQxNNW+058b9SdMkbtqavF3c6132UnPGqJjjWoblVjws+TzHQkVPeE2au8F6dRA0azSuufPwyt/0HyeBKVHZVdkdabBb7R7juEJCWZLqT+K/x+EUwfKYnuh112J7OOkus2EEP5A6RA9wG5ajTZSUSLnErQ0xZ4izChknVOwbsBV73Q9VsK1gDnWyL6OgwBaTN/w06OqrCog7O3dpod/viq3PszIB0V4eJ5AxfHp1TV+DnOyCXDlisazjdNo974GNNFAt3oMsU8q4vqOWF3CmRDrK34jtHq1K8H7NdjHxsH0VYW5TmP7lRSQ6b3iypmbopRWsc8RRCyrfuYgSC3BASzqUctZhbNL9lo6RA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(136003)(39860400002)(366004)(396003)(451199021)(6512007)(26005)(2906002)(86362001)(6666004)(6486002)(52116002)(38100700002)(38350700002)(2616005)(921005)(186003)(110136005)(41300700001)(478600001)(36756003)(66946007)(66556008)(316002)(66476007)(1076003)(7416002)(6506007)(5660300002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CjRP3YKvVtgHap+HKFnHf54MYC8YXKstCa8na02Kvl/g7OhiqKtgMhUawCUN?= =?us-ascii?Q?1OtXG1yjNnvZfHt5IpM+C4hLH5XxotAkeNpWEHsU09zFB7ybMFjVvOctGfXs?= =?us-ascii?Q?yoCkgIVjG5UIXuDg/7Y0s0MoWeJD+yAxhYD5k4Lq+NQ0+fEOkW3pjC5C0J2U?= =?us-ascii?Q?NZ6Gz+gCK1nrW4wibXMrgfXD2QUD+nqPU4UgjROqxQd2/GBWTYZ+tzDhcYHx?= =?us-ascii?Q?1A0RDVx+bUlmLi1e+6wgTABSk1EgHT9uX663nHIeBzgrSPoRLfqKBA8xaVY1?= =?us-ascii?Q?Rby6akJ/29tTbSPf2Bzcb8V3N7KQVPWKiPT6JtC3xteQIPhvzWG4Nbk2ITHH?= =?us-ascii?Q?KvJXfrPV3aCtNoNQUefKzoygMOG5EBB3g55Dr3l1uR/P3XllS1+uswT8IqVF?= =?us-ascii?Q?FMrGVw1Q+qFbTN3RGf+qhCMoZTrP5nMPcesiianmdoh3f+aj4+npp8WdYksB?= =?us-ascii?Q?PC13OpqcEkydo0mizvUUpQGE1aEydgeY8JX6l0LorrJo7FLXquGtON3I+LPA?= =?us-ascii?Q?29PDwLAs+Nb6q1TWf9BPhWIt00nB+fHv83c/Tvqy/MQKUY0MAUFo6YlZacOD?= =?us-ascii?Q?h9vnI9NmlvwahHSrrL8JE0NpeafPhwegwtd2CMpQ8y1So5BH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ZABIznovo2oXa53nHUH6ZKgmRAFdJsQQGWFXsgyM5nSKObz?= =?us-ascii?Q?Wfc6QEhLYVUsO/56Vurp2of9sCSIqZO/H/KcEQMJ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86813297-e0c0-4536-4c10-08db78267ee9 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 22:24:53.9665 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wFZY3ZKtdaU2SuRmQSalrtmXFH5AqBaHJBUbS3BW65AtuecJfTmP0ghNXsWtdu7K7TdxxLQDIQ+YB/yRuB99LQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9978 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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; -- 2.34.1