From patchwork Thu Nov 14 01:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 13874418 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E57CC1C3045; Thu, 14 Nov 2024 01:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546136; cv=fail; b=vF/mGRthY1gHSW5DkLP7Ku/M56S2g0xi8xlkGyN7Kd0TuyfF0JGXAYiomWdUVo7Ovo8NPiyV9JejzxUxZdl/Ci6W+hM1/hdYQ6mA/FLdjF9AlHemfUtLZ0/diXhWXugoErNhKh0BqO1+9PG0+xThsQbzwftDNNcmDhTEFhnwY5E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546136; c=relaxed/simple; bh=D9NrUQWM6ig3Xfgr9K9voYdPv1enmUGl50vaCUc4d2s=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=fTFyEoaT3FvktwxLI1vEWKcCCqozWKPtkyqNujYM2eoi4TsAoprami7Z4UEY/0sKyzttq9AoruWBp1fQv7SsdNlGacghNCy+s8YWTBSPoRSJ07gbvKMxpyiXu6u8ImoCnDeIyaNz5Ix3pXr1RR6ZGSw67rNlXSUNspDD/VwrztU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=tfqcnSw5; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=UtLP9ZLd; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=fPGld+7m reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="tfqcnSw5"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="UtLP9ZLd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="fPGld+7m" Received: from pps.filterd (m0098571.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ADI9D8j013119; Wed, 13 Nov 2024 17:02:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=SzRyBh8TktTqS1eEjX7Dq0+VO8Td4AwIXQKwKEanIjI=; b=tfqcnSw5gO9u d9xeLUjz9cMQxxOqx2QGgv42wkfLU54wNxd2/86JQsiQ5VIGDIBoGgyVzUPgDKxN la7w6zga2KEp8QMkN6W5b95bSD9HGI0qbwHfhYnXDqOCvdT9Ta4MQwsSldr2Rxp2 7xf1mIZsxeVCAq7pHUskeZrehmHsmx7qqb/YNfIBpwlnprzVBdkG15uRqahnt+eX STT8xYZhqgGYMLvSvWt6gVr7MDRie0BltHdMhT7dyi6Dhmxo/nHbaUq/+bsUswo9 FQBpeHJhrSXwqxDXXIW4iSGEl8RdQnwTkH1yiBETlgdPPmligJRhOD/thmRSv9Vi W0qrdj4pFQ== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 42t7mu9yu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 17:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1731546132; bh=D9NrUQWM6ig3Xfgr9K9voYdPv1enmUGl50vaCUc4d2s=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=UtLP9ZLdCUEF9RW9mJnrvVaKI53vhDBnXgMv+IZ5wB+kHVqSoplUyo4NC/udero3a OYlv4wgLRojMjb3ZmSQ2cdvqUiAiPKsZ2TKnOVSkdBNHPquqJfF1yJt50aJ0wxZvPa AxmySXWXloWVkn/1cjEuk2HEt/LAY7m3t9xd/vYVhmlicC2F09R2pnbF4OnVQZE6j/ AGsIB4R3/UkA5l4zmvoCDXyaHAQOPz7R6ghbUgCotxfP8FgH/LcSVl3uQI+GXsyL5P ydimmtCgbNSsoQbnGytnQIRDG5aXvzi+rtbe8SBnZeSJmFDfPAMH5xG5wjoh1JKOU7 v8/faN5mtkkiQ== Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id A33614034F; Thu, 14 Nov 2024 01:02:12 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay3.synopsys.com [10.4.161.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 218CBA007E; Thu, 14 Nov 2024 01:02:11 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=fPGld+7m; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id AD37D40424; Thu, 14 Nov 2024 01:02:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gT7/v7FJFnfR4tZlIHxdlCeW79lTa0WbaEo1WdCVPit9XHhbD3RG644iOmtYNHoqYy5KyxSqwF/Y59pee0oYfXcp2XFPVCSi1sT+0DVxApLiCptMP0ouLHNwbIYihiusYTFcMCrqzQ43ZhyoaUTbUrAb8SXz8L29CEwQ20pYMBOkWuWbUydkfAfViXsM4UHGIjxtDk77l18udZFPM324Kba60O5qDJi8/+LJxm6zNWdYCrMlBUoGm6sjN+iCN6GVlgWRX0MkUFBU3XtdxRG/Sisv7DS/QDFQmCDOhWysoXfnarU6PRFkWw/82dRON1U0P8Cob1yLXw3uXUEOMa3NNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=SzRyBh8TktTqS1eEjX7Dq0+VO8Td4AwIXQKwKEanIjI=; b=nYXbZu7kxROITiNYXGFN3p6CNPmeMupIkA/9xUVZdOhpoKI0DHpPMto1u0O7oNLEtspaYdE77/W/HRvMinV7SrORMGNBSvWZBgT+DDVglUg7+ADybxkQ0spVPQ1sQ4dTCez94i/KNA4/JfypDk8iTwNhi2e1gj36ezDn47reZhzN946nuZkwRcSF7w7+vnopzTUihM/Jy06HLRyUwAb0ToBLi8RfJHv0Fzsx6nEip5Qf1ZLBivX7h0yoRUH7UdWX6YgcM1V8qKLIeUfQ+oAKN8xFLjN39eS2qx7/UfrO74Rq1zKs0qUADvpz265p2upNUGXRQyN0UlCFkmY4+4qTUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SzRyBh8TktTqS1eEjX7Dq0+VO8Td4AwIXQKwKEanIjI=; b=fPGld+7mgWF4TxwswZexNMWu++ZvP2+LksMNjmo3HKpet0829CaL8Mf5LkwCW+z8KLpVTnzKquVEMKO1oMKVcOIqaT0QIdLTpfCRrhOJ3Is9QmR73INjp2+vfLT3WQfUOmk4zYqX7Xe/AKK8NBqHY9CS+/p7K98NCXVLqYLt43g= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by SA3PR12MB7950.namprd12.prod.outlook.com (2603:10b6:806:31c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Thu, 14 Nov 2024 01:02:06 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%4]) with mapi id 15.20.8137.027; Thu, 14 Nov 2024 01:02:06 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , "linux-usb@vger.kernel.org" CC: John Youn , "stable@vger.kernel.org" Subject: [PATCH 1/5] usb: dwc3: ep0: Don't clear ep0 DWC3_EP_TRANSFER_STARTED Thread-Topic: [PATCH 1/5] usb: dwc3: ep0: Don't clear ep0 DWC3_EP_TRANSFER_STARTED Thread-Index: AQHbNjDTA4t+gtEQZEqWcTkch/A3og== Date: Thu, 14 Nov 2024 01:02:06 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|SA3PR12MB7950:EE_ x-ms-office365-filtering-correlation-id: 7e2c01ea-6193-4e1e-aac7-08dd0447f58b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?PHc3Isitl/zwK8vrmhOWDo15w7?= =?iso-8859-1?q?kB6vITjctEEAudml2lHasnigFfxUgqxQm7xyKbfgmm9AoFmwzw1+QrF7gfQp?= =?iso-8859-1?q?Nt3HhNXPNKEz0pggY32eqN5JzyDrDDG3IkRDKIAeJZUahyywrr/TFm5WqrEM?= =?iso-8859-1?q?dKgJ6OF4fHkDXME5jFEDgaf6XoIXAMxVL280zhfYCSIVUy0EIN2UpbAHylRa?= =?iso-8859-1?q?NusAgp5/8CUeUXwQBKsEZUo3Uv5j+6zPuVg0TnaGAxOo/dk/mz4dyy64eLJo?= =?iso-8859-1?q?RME+6I/der8MWeu44K2Ns+17mjU2HHtU7RiFvXkrA2gjR7S5mk5g1qYA2veT?= =?iso-8859-1?q?BwcIpuzBvx4faiuJmUN5oVa5drnkTbd5Vz95OSLu6S5ps1KBY06Bjkcm2zBB?= =?iso-8859-1?q?noAbMuGrpv9vo2FnB5lqgebGYk9jhnQ40NJG7U+YkhTVAJS/8BvazeJoPkC7?= =?iso-8859-1?q?pby3+fWna/xWoj/ixkVcXdVZmGWownISy5e0SpScbwhrfxSDte9K5OFF3g+z?= =?iso-8859-1?q?Sg5ePT50dTO579FrxJTXq2lyHJYpNgmd/eyPeT4IGGy3StlgIWdEQVnZhYCA?= =?iso-8859-1?q?CdrMJsthc/8Wyithoyfh8nM+C6TAG2N/yQUXUw3EAkRRGFUzA12OGWemRApf?= =?iso-8859-1?q?xz1GMrQuXF8afOG6DWUIRlLV2HMFhYWz6mvhlNWuQaZYleDFDdc6hcZu3+hv?= =?iso-8859-1?q?d3Hynx2O7/QmRY9kg7a1sYy+Qoof251KV3ZUEiE0sErwu8JE1sODQbQiGXv+?= =?iso-8859-1?q?GEtC5g30heReIEDjmk12uOp9gO7YLbShatHmWC1vkeoFDsxsGqZ/xc7hztCA?= =?iso-8859-1?q?V3dNOBzxB/W0aGNo4ioVjECGHcHFYaoSrMWf3+Gl3mcr1jB70A4pUrepoZwX?= =?iso-8859-1?q?owPas85/eON8RwOX+trdc+mT3UFtdIwXthmIkqLjil+vNrFI6FKoM/QF3TRw?= =?iso-8859-1?q?Q1b7uuzHzrdDLjM0oyEL2iRnhJcYgWBpaSE/FKk43jJGoe3QfFW6ZMVc98ah?= =?iso-8859-1?q?aZYCAv8niEoPE0xIWPy/FSvZ1KAeTjCJZ/IsMgGZgCBuiNjFonthi8ukKcEE?= =?iso-8859-1?q?F/cjWx+hLo6abht6UiNWtO/p0rhKlSa7fqC1DFStITS61V9/PWHm2cYoyI5A?= =?iso-8859-1?q?Qm+rpHeB9BiJ15OHnFfWDgkyTSo0/x8JpIZ+BQhiZ9VYOTjTP/NsePmKpoj1?= =?iso-8859-1?q?YeR1Y9CZp+cIiAyHTS9hYX8JS21Wz0C8ngzait7Qbu8+fy7DsPxjdS/Hwsht?= =?iso-8859-1?q?ZTd9IawJ9YjRJNbxZMljIyl1+tICsCTGTACIdWi9sa5mrmB1RuFSzGnSAFro?= =?iso-8859-1?q?Y4MjLkOka+2A2phcxK2bOVkVFYhszVNAarRcxKl/ti9/iflZWM4WVAvQH2EG?= =?iso-8859-1?q?iWat1P0lW3/yRJ4Fd2SC28FMAarapf2NiaN0mUJaA=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?3R1mMmcsG6mIQyPMsmxlDLJ?= =?iso-8859-1?q?ETcvhy32axytjJMOxnWVrmtqLIz3AAFXpdB+BuHvh85U9qP5XuSdNWxoC/Zd?= =?iso-8859-1?q?+IL3RGliYIfDVuz7DyFiW9GneoeNS2AzQNWutyMcPMC1xbuQ5e/ILuLv9kQa?= =?iso-8859-1?q?Jsx1TsXVImwxbEToFuOUFPyEpEttf+MkWCCg//1fl8RHR+NR8jJeuJxEvC5x?= =?iso-8859-1?q?pgTV3B/Ci6MhL7ODN+L48Q9OfAi7s2pdF1mzU0vq42U9HtLg/z2L+8BPrgJB?= =?iso-8859-1?q?87vmbLCzCNJNfQ008iweqPldG8gjL6sQvYkDMpUiwtxjMMUrISvmXUW2mp5E?= =?iso-8859-1?q?gIJDEravR3/Xcx8hCYsuo3ZJCE3i+M5l+yNdT6MNq7BAVFcpuZiPMVKv6T8n?= =?iso-8859-1?q?mEgHnaa2Rq7drrHcYbGKvl9sfvh76svJ2BiQdsVYCJydqog7n56OQcmhNv2R?= =?iso-8859-1?q?eFBpTlxcg4dS7gZPhrcH/7U2FfC89OzqT2g8Xgj/AGCf2XkoUk2xsSoqZvAH?= =?iso-8859-1?q?i8yOm7EQjFU02aU7B74Yr70pGB18suW6PvN8LWnHtOuVfGEO3OCHLUDtDhBL?= =?iso-8859-1?q?26jAPyZz08v42AGHsg97DgEuwlxdPnkvXQDSxR5rxFStDHhT3nvZNzmxvFYv?= =?iso-8859-1?q?hLBUSh/z/rylXQ/BAT/kijPqTCexjOfuuKU5mRzVZqrerOPEeZv8ZhGd7h8d?= =?iso-8859-1?q?R3+mdVSxQ7y9A/Y/f9Xa9KM7CLLHa3UuJSisiE2pv6nRG7b97nsfbr2PJsVY?= =?iso-8859-1?q?WhGNJgl4mOW/xSyuD79XHFZiWTmKFFlP5qpBs/IPQHhCtTjvFH/s78wYUUXl?= =?iso-8859-1?q?lSiysRNq6Ob1TcdFypYWfDIp+iZjefLJCon7v9uGZ7DYnhbdhiA6LJfgZx0X?= =?iso-8859-1?q?yGmqmqGxLvMhfKzMPQGvsosyYIBmJLvNRrlcRn3fuoHZJAH4zjMZiT7aIF0I?= =?iso-8859-1?q?bhWFkR2kbEAOc1Famy9CThDd8Bi68SEU2b9o19+sQ0QX5l3w91j42feDIZye?= =?iso-8859-1?q?F5vcCct7a3MwBJWErX+D8Jjmi7koL0iIwYJxyJ4bVYifW5GXRyKNUXgtOwtf?= =?iso-8859-1?q?lentlJ8l5zuuOKl2IBAb8HUrvD8oScGiCL8Ergi99qiLyIT2Ctkjcezzlk6l?= =?iso-8859-1?q?HI8eRfCqLdBLzBatqUrDV02H4FX1PabVvedx4SSfYiaEe43HCkiIr7pCE/M4?= =?iso-8859-1?q?sfraNsGDp3mAYFB8wADUnamReBnIFdOt8V3rmE76b0NmgSkw+T44KnW4Skdg?= =?iso-8859-1?q?3mJWU6BO2Sdpx14MLtZIj0ynX1t456mIFCdt078y7ZC359GBUFMl4RpXbOMH?= =?iso-8859-1?q?EgUg9EyuzpuObGs1Zkyjebh0per8uazo89e24YryRfjND8RRqekQXkgBufZ7?= =?iso-8859-1?q?SjenUOYplGVXxr2s6tWrkcURy2UvdnKYam3Dfkv891rVHQmi5XxriAfZWiN4?= =?iso-8859-1?q?SBoSaOboTD/ceEP+LNXXwo3VGXm/gOhOw+1+64chFu29JTHg3H6jjQYPzIxx?= =?iso-8859-1?q?RCGVKX+QuLlVEQ9Ebo9limCPV/K2ZnrA6V7MxQ7jQDfu0+H3b8ShMSFLV5xX?= =?iso-8859-1?q?2EOpVHOk48y5twjUSZrCFxV+YxVt2pFLBOH0HuvkdrCg4JR1WAZXGU7A+JWw?= =?iso-8859-1?q?HTPPP6bAeZ9u4W1pQ?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: j+ZorLAwpbiKMyUlKRjHk71bCI8mmwvobTQBOjyy0aJUr05/W2YW0yTihVZS/8RmSH8A04AhUOxxOB1rJ5PraPPfjsmpl3gTs9ZO4Dwd5NATC96ANaQ87hslwspctWPOW+9t1tCcxWNOhSgbOiT8Bd7ywGyMIuo53Rq98s/xT9pWY0g5D8J6EVMmuUT/T4ZcZeM1+VgjKRLwRIGpXvt03PVsFnDAhm/xBdGxltkWYuhlyDmZ4UPzof7U9t7TiIqgMoF2YhhS2YUnPr3/tfktN0ROOI0IssKs1IorN5kPWi1u3sTJ8XUiZaYGCNqZPaLGKbnjJAszn7Knh8roHf1FX6J6m2Kjz9fMw/U5cSIxAinXN249iT0tYee4CarCuxjzxi6Ie2MKnc0naqbhdWlxBat1Scl4i4MFwrpITwIjxZpQ/tNanenpPMgyRKLaC8+HG8osvz0xc0NKk7Bq6RskBB6wnIhAIHxs4z1k9HdmOevnYUBjsDxSjqK56uDNy/XCL0LOOedlfSwFlhhNpYMmjnUCF1Y9HXfAlxN5vDb58DC48/fFPi3gj55uw0+Pw5iZ3Pz10SrbtwFgR5rzZVmgTTHWf483MS6Uqb3rQxOG2ervVBybTKMN9+BzvkkdlXmOIKSenLkEz3p/9/ixW+RdSQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e2c01ea-6193-4e1e-aac7-08dd0447f58b X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2024 01:02:06.4723 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Lw8KpSBSaJv+YJU4yb4YprDOu9Zzc/8R3Zwp3ZHWAFSJEJFjNLz6INDtBarnJDmGx18QsnTpS7njT+EF3kDd4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7950 X-Proofpoint-GUID: JN-pv9gGG3-VPz5z1TtCIJIx7V4OYVfk X-Proofpoint-ORIG-GUID: JN-pv9gGG3-VPz5z1TtCIJIx7V4OYVfk X-Authority-Analysis: v=2.4 cv=Y5mqsQeN c=1 sm=1 tr=0 ts=67354c15 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=VlfZXiiP6vEA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=VwQbUJbxAAAA:8 a=jIQo8A4GAAAA:8 a=ekUo5NEpdgRYIMB-EUUA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 phishscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 mlxscore=0 clxscore=1015 adultscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411140005 The driver cannot issue the End Transfer command to the SETUP transfer. Don't clear DWC3_EP_TRANSFER_STARTED flag to make sure that the driver won't send Start Transfer command again, which can cause no-resource error. For example this can occur if the host issues a reset to the device. Cc: stable@vger.kernel.org Fixes: 76cb323f80ac ("usb: dwc3: ep0: clear all EP0 flags") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/ep0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index f3d97ad5156e..666ac432f52d 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -232,7 +232,7 @@ void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) /* stall is always issued on EP0 */ dep = dwc->eps[0]; __dwc3_gadget_ep_set_halt(dep, 1, false); - dep->flags &= DWC3_EP_RESOURCE_ALLOCATED; + dep->flags &= DWC3_EP_RESOURCE_ALLOCATED | DWC3_EP_TRANSFER_STARTED; dep->flags |= DWC3_EP_ENABLED; dwc->delayed_status = false; From patchwork Thu Nov 14 01:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 13874419 Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96C031BD4E2; Thu, 14 Nov 2024 01:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.156.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546142; cv=fail; b=mehZVtJ26IlowAjY2qq+VrhFJzEvs3A08s/bRdXQ7/LuFJ09sxG/JGNqfseDbiuCprZw8+yBBQy4kwMIIdlAskq7zrWoiKZXt6bAJGws8AYl/uu+697aok1Bpxih/ugo9kCCF/zFMEv5cyfd3iSw7rUpdjk671+YrQLgTH9vsGU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546142; c=relaxed/simple; bh=bYvs8tcpr294vK7rXqOiDKRMrIoEHdrS4Yx1BLzmqGM=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=aqCbJLXiQw8vkGFlYDgU+aepCHxeiVnW5+eZWbBCc/Wu/AFh5HF0zWDN4EUZfRIV+jDmKHWVCMz53NLHVdrG6MHNNDnJKaXYuQNN/S1UTFtvYFsI8o04EB0ZvAmvuwb7UTvh2VfcXXFG2eAYWgP8IxzLmIe0ss+8LcPTEZEZjzI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=LoOFqZk/; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=fciwpJBN; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=tsuBiy1r reason="signature verification failed"; arc=fail smtp.client-ip=148.163.156.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="LoOFqZk/"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="fciwpJBN"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="tsuBiy1r" Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ADI8FEP017220; Wed, 13 Nov 2024 17:02:19 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=3ZXrwiZ4ir0JHDqHd0gvin1gw6GsK2wqKqCKV509PiM=; b=LoOFqZk/u+Bu uMUt/g/KapaQaRNmUw4IUsbkba5Qsk1kt/ZR2kYZtBBeNwb9lfNosyAYPQVKPJ7G 6OVI0onNcF3kvdlZKj4H4o5tNmSEbk8ePj7ql8+MHSfDcONFQzMTGp4MpCgg03Pw FTV3WYagdSwfbDD9/6gsEMBqGd76G1Oq0wEVJOSF/K9gpeiixKi/AotVC3iCtGjY gONgrUXamm6bsLXQZ57yRb2zI/rScjujYpUYIM842Mjn82IlBelTqirhcaP6iv4r lzOG4uV3Y/8QdM7TTW+rLzOcJgkR6+MKhtZQXInLk8yd7HWpyaZ+dO1DxQkTzisT CzG9wy+C/A== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 42t7vb20ab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 17:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1731546138; bh=bYvs8tcpr294vK7rXqOiDKRMrIoEHdrS4Yx1BLzmqGM=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=fciwpJBNWrmtO/UYmdvknWoqGhIRwOcFROPyS3N8i5VqCAzm3Trr7srQS5j2i/fhb rcS3GxRLELqEtmkMpSlPRUSn26+UYKwlqK2LXWcrZGUeqNfKFn8wfLvvnCOoLG1F/F oRITu08Qup8Dez4PIOYQjgrIBKbnvznDvyqArELe09AYN2WqvPkl/YcAspxgxe5wEP GlXQGGvn2tefaIlC+0NCJ/mcSB46IJqhVGPDY0D6SkjM93JXrKfrsXIoiG+Qdb0SwQ Sysd3vwGqROinAItCS23agqN/dDZqS1L3ZtJGpDEr/AbhcuDbS7q9Bpx/L+MrRWMNa bKfqGDUHAwjvg== Received: from mailhost.synopsys.com (us03-mailhost2.synopsys.com [10.4.17.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 3D60640126; Thu, 14 Nov 2024 01:02:18 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 00F2BA0084; Thu, 14 Nov 2024 01:02:17 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=tsuBiy1r; dkim-atps=neutral Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 4BC3040114; Thu, 14 Nov 2024 01:02:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kElvoeCmf1eDXCdEKxp5TCEDYYSa8Ji9+hP7nOUR8mTT7ZLEUxN0NxNXBh/IL2uC0sQP/Tzk/JefRm2dYNRTkhqbzbCIqbCS3Ik4HMhxa/0m5IQGd0RP+c1L9ZPz9ClfqaO2Gl7x3YcRiSV2z18+D30VkG+rgUfD+vEV1NH9qexdnBrWLk7gMK6rjllUl9m4YBhfo01GFctgrJEbhgjpwdr13/lDHWUuvR2ema/MMT+F00o45K5M6THs1EQwDD8Fc+QGYQfiiT9IzoqmBRsLMVlCWD3OsYsuXUsuZWnlPk87GvtgOj8W/g3XV3kgtUtzU24TBGwVlW6nk2cuQs8WPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=3ZXrwiZ4ir0JHDqHd0gvin1gw6GsK2wqKqCKV509PiM=; b=QmFgFq5lduGqOcvTb/7LcvKJ7AZHI6P2okt+gfmKjO/0x9TkE1b2TfF4ucdNmL4Lh8rqcb5fFF4GugSc11EXY2T51+D4a/BQ/P70kdujFRNJZh+JBJeetD8FZ/qUsY1fHAH9nWg7osrAbs99yQLRt/JdsdLyWd8v0f6OJhfS0Sgbq5GwY5Ls31wJ+/fy7JwL7XA1GGXV5MC4Te7DFoyKEOzWgbS2MRz4NO/t0X0j71J/cRIanT2QH+HHQaRTA1efVHQDGLnCHJ+0f+cuzf0sVuR05fjbAOhoT6CIH526Ijn/3DL3gLPgLwFp6dpXNXSsb4cwOkVUTNgSf/a4IwdZ1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3ZXrwiZ4ir0JHDqHd0gvin1gw6GsK2wqKqCKV509PiM=; b=tsuBiy1rGLsLvxHtcnsoT9PseN6keFtJXxOwuc3luMDdUMA8TjWStApSxQMO7ZhJErZd8Igch8jlx0SIzLL2aStiLGlDzWgJE7J23ChLNRITK7BIXUHAKRqAhb+GENnWWjWuQTm5hZVAAHch73lguuWjQPuZ8pbA/2fE2F9/ucw= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by SA3PR12MB7950.namprd12.prod.outlook.com (2603:10b6:806:31c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Thu, 14 Nov 2024 01:02:12 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%4]) with mapi id 15.20.8137.027; Thu, 14 Nov 2024 01:02:12 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , "linux-usb@vger.kernel.org" CC: John Youn , "stable@vger.kernel.org" Subject: [PATCH 2/5] usb: dwc3: gadget: Fix checking for number of TRBs left Thread-Topic: [PATCH 2/5] usb: dwc3: gadget: Fix checking for number of TRBs left Thread-Index: AQHbNjDWG6td5szbI0yZCeDKS7tsqA== Date: Thu, 14 Nov 2024 01:02:12 +0000 Message-ID: <708dc62b56b77da1f704cc2ae9b6ddb1f2dbef1f.1731545781.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|SA3PR12MB7950:EE_ x-ms-office365-filtering-correlation-id: 9e033aab-c0c6-44ce-48a2-08dd0447f93e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?JNjpdgzvGpXQASJ5X9FCB4vijO?= =?iso-8859-1?q?0NzXK0qvM2k/9QKk4kHztH9jBj3ImpA2Kowikmfs58V+LWdU5pM0xmCUpkeE?= =?iso-8859-1?q?yEmaeuOcd5DCgNNj3EW8JucTvxd28pjPXbfgP2tuLrvkX9rrzammaWEBvgPb?= =?iso-8859-1?q?jLAyM0kijsYn5fKKl0cSAaOkVOSJ8s9HSDrsApK52we2YWuriNrue87Zmzcw?= =?iso-8859-1?q?rSGd+nm5agooezd8i52mpabwOC4gta01DV4n8p/jWCy7W5/wL+YwU1zXVbFG?= =?iso-8859-1?q?VYcaZ/Gp/U93uZG+u16quyhF6GDaRHcg9ujvHjavbFzgNmBaG4SqVSE5slNt?= =?iso-8859-1?q?rMaF/B6VD9n8F8ed8O4f2iBDitCnep8eFmHyou91PDSkKKrBZVUDaKY9rcYb?= =?iso-8859-1?q?HGuKB8G/aJ7c8LM6hwb2o+sEIGxD/mABIToxH4I2mG5XxhRyqmvqhkb+68ba?= =?iso-8859-1?q?pd+5cUEEDifPoPMFnbsrVxWze3/nf+o2WId5jnJBc2vheM+9OtcfmzXm8TJ0?= =?iso-8859-1?q?oUbiQ8nNpyFbsCkZlKk/WcuKGiRRNx3diQLYxn3JbkHE4Q3akhWhnR4ZpBQu?= =?iso-8859-1?q?zEGzYDYsYiKzNw4GMo8kVIXV5na4AipHUPPDh4toDH3cGY1FplsMOQ6hnamf?= =?iso-8859-1?q?kUh9HB9QZ6p+U4WZj0UxYCiYPZvzmbs6FussxfqdmqTDnDo+VSN2ggGA65A3?= =?iso-8859-1?q?lH/OrVAS8plJgY8N1P0lEHP54BCfREoElkaThiq0HjtH8X7KGFwunyR8Ya0K?= =?iso-8859-1?q?n6WfslDv4VsSDiRdHzmJmmmE0ZhiCcmTIKBMzpq4E9D2DSMqSyukuVOTLZGN?= =?iso-8859-1?q?HfSEQEqmut1F9TuGGWa+XmfVxTZuG1J6xuswYmIjLeQB5R9RntCzHGzxQv0q?= =?iso-8859-1?q?33VcOdlFJBoNkW604G8900E1uAqyio9ok+2sXbUh+VY0X9jzz4PvqxYcEi33?= =?iso-8859-1?q?iVt6IZ1JuH+glWpfgoRcS/lhb9SCH+gDZi6H93c3WFsgM609pgwv8cSQVdms?= =?iso-8859-1?q?3nPlgiPDHUQZ8HkUIZlVj9oo/sU5lnLshDB8OJK6uXZ6P0p6zjQEI7ZNGd5w?= =?iso-8859-1?q?Hzd8kzrkDs6xZVYunqfBCX9k4q97lx4MdPs1/mDh3j/liiCaRSpjMyvsOJJ7?= =?iso-8859-1?q?wfXBu5QZq4nQ5yNnP/hSczMcQkt52N4vwQFZ1cV74AiVjLlVeUnz+d5MbiCo?= =?iso-8859-1?q?jdzbQFaGD5fsIxoXt4vKh7wi1CsKepFCo5VNJjbBN7uAx+Zln2hL95RkDet7?= =?iso-8859-1?q?bNPgCVtiU6FaQ7oUfdMVOpjhACYxLWRG3GOvVGDmYs7hdRgOappxIEJazNrv?= =?iso-8859-1?q?HhcEwH5m12B53NzOmaZQKks+BNV2LBGgW7h7IyORQjQJTy1cPKKFT+6+OA3O?= =?iso-8859-1?q?s3Tw11KBWes4aX64xu96wtXUNaFrOhP4YCcNjcZSE=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?0pjnpoDhWQhVAnrVN1Yy0tu?= =?iso-8859-1?q?Juiob8OhiwUHI4+5VHQMNZonCfx18vmVYUMGoqiBT+bygMkC72MyG08FSgEO?= =?iso-8859-1?q?d+k5T6YRGP9DgioaoJ4Qya+NnXjmeIAJLc9BsMaWzxKelUwoo3QQpYTMnHNM?= =?iso-8859-1?q?KtO8rMMgHI/xhrj0OkK7zw9N0w267hDLH+M+CrgCA+cDTpoEsYwfyZJ2X3ej?= =?iso-8859-1?q?S+yMY4T3sx49WFL8uydekuW799K7ZpFjS4shqnxZG7+GgRdrMUp+b6Y4Oyrd?= =?iso-8859-1?q?DHZ7jv1STI3J3rxc7fK9jkPfYFw652spUirSYTq2tkQI6QXjxXxd25gtmu9s?= =?iso-8859-1?q?XtBGba4h7euY5iefRS8Z5OBTUsZWGo8iLOKnfQMP/juhqtYzLiD2Znd2Wy2q?= =?iso-8859-1?q?F1QXS2mQOWPyxmu9d1n3BODOXaYkz1g+EmNilR/yVpxHcxGFcpSRa5zd+APg?= =?iso-8859-1?q?ttAIeXbHBRj2KrtVQsQd943BR5bd++D70hEAyiDcoVJW8SyaJ5cJpLBB9W5G?= =?iso-8859-1?q?jNSLA9g8MgtpZ5ys2/sA0UzOex4Pm5azTWxihmE/GX/aiuJNOllU5vKRjpoP?= =?iso-8859-1?q?CsXkXKrCy/xW8x+XO+yPAMKnRnrUoVlHqWk9Pof9DBO5c3F4agKwvSZ9hwcB?= =?iso-8859-1?q?gCPYAfyOpRKQfkMnNIRS0AG0eHNN+coKNqrn47DVUmKWS+ZorJZipjJLChTU?= =?iso-8859-1?q?AuVeqnwGx/9oXObm2lKwH1Js69mws0VXvMaMGsatnOGHpx0aGBdW2Mk3jdhg?= =?iso-8859-1?q?uDJcVViIKd4jT4iidw+F990lg5o7nXSvPpNU5QEDXlyN1sZzPzkzNjYmm+Up?= =?iso-8859-1?q?7317nOlFp7XbgZxp8H8EpDnn/ErINe95LHw11LF/U9iO+F4YS7ujUu420H8x?= =?iso-8859-1?q?U2UfVyX4mxlE8lC5KPgm6GWLSZqsgp7g5PmLL6ODVFSFNuRYuLmC/HqVX01W?= =?iso-8859-1?q?W3+HQ4NcLNNJHMZp8G2W2KETR8axHNhs5L/411ieJP6Kr1ujapJDXcjusTAe?= =?iso-8859-1?q?EKuPvwaP+MFd0b1ANcU0uvCHtoRInGOTWtV/JN65bC770cUI0fGZDk/fqTSf?= =?iso-8859-1?q?Vucwp5KVKiPdQR9FS4uvFFRVtHc/McIR1qwIlPd1Ey/+NUPVOBfWBXLt97Tk?= =?iso-8859-1?q?7Y9/dB3Moqlc1TkQVrkrV1yOv6baArf1fgm9qpsjQTfemi713sKuGN0ZlIqA?= =?iso-8859-1?q?rCbF2ps7N+4NF9eAfoCSp4nshgpuubWNBYjcb2Hl7gHp6SOjiGrddvHyuecp?= =?iso-8859-1?q?a/5WCcYOhVrR4crhjCltgswVUTUdR/9Qk2w6ZLmROMZQQ7IMiFIVjxlHLLZE?= =?iso-8859-1?q?cfSjm1EHZFfRZUWna7v1ijQ/CX6xaMt0zm+kpoC6IMbtziNbLMj/U3+YBLjW?= =?iso-8859-1?q?dJZ1UBa+D1IBhNtIMk2UTDR/d6SPAKP3suiHup6OWKRhZqy6caPQWFtfF9lI?= =?iso-8859-1?q?PGnVwUiHoHa/OYSEApZjyFi9FrO0pIBdzk51sb8/wc+U5RUn2dtTAVJwGoSm?= =?iso-8859-1?q?2zIhSuJEn882wfl0+BVXGUFa9me8ydoz6UkK5dE2x3XrgMuArfiLblHHZmq6?= =?iso-8859-1?q?dhVHF01nTHZVUNMFVJ2QuRChUEnVhtlBV2cqcUvQxNyjuYN1r/aedreOLL0k?= =?iso-8859-1?q?2P3OydFC4iLjBsN3L?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2bPcxFJPRipBLwdH3HVYUTfndsQXJYmpVcQfx6KptHz9fOpVq59yTtQ8nbGt6dvnKn8Q4ccgIjsDknU2ajx2f0NV7vm6/d+9MLBo64uUOqjQlmU72014RshMzyVa60C0oWYiUCT7uSJx+W7x4iro3aZ0ndQaP87BXKHA58o2TfH8bEnmUhRwKw9PWMBUjm+hnF95txPGOU4EV9ME7eyVzjS67GgXw3is5G6SWKyX9phG9W79ac/IL7KpEAT60P9OdLdvwQYwp+CuY7ymg9cOwVmlJgeNaP75EQl2K74APIRkFFMOkDdWstebB/Kpst7vQPhja8Bci2mAdkRKjisBG5DsBDyYYJ7gIGvPJrfZsZIAB/AQvBDiDTZyKA/FlVmECxB1EC/DNAJnIQejPfTdwLmi1+LSK7hM91Ms/LRuv7MdMpe/6zXCkkBN0iSmR0d3drNU5mY9/khzqF08EIGQ9HoOcjROOcV2w2uld+Q13iFgT7XbD8OTETONEYz7C0QPxQhvw0cpMs5nNfJhmc5+o2n61ENBJ5clAzaYroZcJKE9loDMwEYZWKCDO/y4Hv6cj2JIHJBRp5VL83AB+yAoC8arfwupIkJvgXEziReb+TcT8ZK9QBfIqjDnTHP6MTrMrgn1jqS5j1zMCIB8HVLqeA== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e033aab-c0c6-44ce-48a2-08dd0447f93e X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2024 01:02:12.6952 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Vl35YNLYtXIHvZ/MdzJcHLP1TJCLci2Lm1D0pGItS8IrHih/8A8ja1aZWLiWp27NAZlr8jZYF8wq+zHiMxO8Yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7950 X-Proofpoint-GUID: J3GDjRsM7jsEMI2pwY5KKQUxOmL_o2JX X-Proofpoint-ORIG-GUID: J3GDjRsM7jsEMI2pwY5KKQUxOmL_o2JX X-Authority-Analysis: v=2.4 cv=CqztcW4D c=1 sm=1 tr=0 ts=67354c1a cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=VlfZXiiP6vEA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=VwQbUJbxAAAA:8 a=jIQo8A4GAAAA:8 a=vgzQuDIMdibFOyEokrEA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 clxscore=1015 spamscore=0 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411140005 The check whether the TRB ring is full or empty in dwc3_calc_trbs_left() is insufficient. It assumes there are active TRBs if there's any request in the started_list. However, that's not the case for requests with a large SG list. That is, if we have a single usb request that requires more TRBs than the total TRBs in the TRB ring, the queued TRBs will be available when all the TRBs in the ring are completed. But the request is only partially completed and remains in the started_list. With the current logic, the TRB ring is empty, but dwc3_calc_trbs_left() returns 0. Fix this by additionally checking for the request->num_trbs for active TRB count. Cc: stable@vger.kernel.org Fixes: 51f1954ad853 ("usb: dwc3: gadget: Fix dwc3_calc_trbs_left()") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 6101e5467b08..38c3769a6c48 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1230,11 +1230,14 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep) * pending to be processed by the driver. */ if (dep->trb_enqueue == dep->trb_dequeue) { + struct dwc3_request *req; + /* - * If there is any request remained in the started_list at - * this point, that means there is no TRB available. + * If there is any request remained in the started_list with + * active TRBs at this point, then there is no TRB available. */ - if (!list_empty(&dep->started_list)) + req = next_request(&dep->started_list); + if (req && req->num_trbs) return 0; return DWC3_TRB_NUM - 1; From patchwork Thu Nov 14 01:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 13874420 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 085E61C3045; Thu, 14 Nov 2024 01:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546152; cv=fail; b=mobfGOFa2fgC8N8F4/NVRxfGu9jlQ4SDv17b9CGi5320BVFNmWIDHBcNFfagsaaLUxi2CMRMBhPOw0XDZifMZ8ZZJ6gS8OUfQYW7ttWn4uXbrrX/CZjeKWfuDLRhva7HXec46sEIx02yLvbk4NMkdLrFNcL2SLurxjVdBQWzMfs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546152; c=relaxed/simple; bh=iyjSWeyHKgmn446zlVIp9RUghsXQBwOc70mz8065Z30=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=u9c4AWnR+ISH0V3B+xJAyu2+rPDLo30NmxYpGDNMMPQPSsud0g80rdEe7VX3yYbcFRbkfndeTTFq0qZtWhWpN668/r2BUFTh8mLyBBEM5Ce4XNOThDnQQ09lPG6yIkpefzQ42scYJ20pTFTA62FootyGH4PZHEOrCCz8P3G8/+w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=VJSPMR6F; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=GrNwBTXj; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=e1P79vtm reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="VJSPMR6F"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="GrNwBTXj"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="e1P79vtm" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ADMc6sK016901; Wed, 13 Nov 2024 17:02:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=GqL8/oKnzCuF2Z3LGMS2Iq4ItonGZ5ovjU5dzrsFR00=; b=VJSPMR6F3lQ+ ABnZUi/a1s4UEBs4lYXQASN8qaxq9Jblcj7NLezVEaWwrHAih3Vikwi2k+CGnAub Pczi2RV2QYsyZszaShRu34oh2gCuJW4JvnOM7YTCXlTAu4bx2vXpN1LPJ0lv2A68 XL/aa92+zR5n5b9UZkw/o8btFeMHpCAa97IXMM1fASYliLN7j3V/M5KOaXHzxxEb 4aZW/e+TeAFSkjJUohI18xLgiFOBvCi5c7/2dsr3Z4UahsFQLoWImBeJPPT8sbxP I/AlFQCu7W3qlHRRciL2HE/xtYZyW6bXVKhtCgfNoRh9Y3I9OOX0A5upP8yp7ULW /U1nbmjSrw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 42w52s8h9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 17:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1731546141; bh=iyjSWeyHKgmn446zlVIp9RUghsXQBwOc70mz8065Z30=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=GrNwBTXjgs4RVYQqtV9L4KtFsWV2ZxcpI64ousX+lOgi5bdDOhwBlC1Uw51ynSXhB 4GnH+1PoD/XlbJrE0Pof+V0KCj0VXhxgEdZh80oA9h/cOCA8CVBLSQJksj1qrukmBH 41yaJsmm6InYD5oMkUMbEcnnunKsE7FVUxxWxXfSvdZV1o//f2ByS0KGMN0ZXrUERl ZyxaBCRdzzccJxz62Pjk+fU3ZDlWsS9W4PCGWem7k6hc6KPB2boP5X5mANHjpaefcW MwXmKL8/Hy4IEw2epS2JctAkMdBhmxHFgd4D9yfHmfCDZJL5dgegy4MZJVkZ1ZnhwH HqtnMHI8xNJag== Received: from mailhost.synopsys.com (us03-mailhost1.synopsys.com [10.4.17.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id CA631401F8; Thu, 14 Nov 2024 01:02:21 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay3.synopsys.com [10.4.161.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id B7AE5A0082; Thu, 14 Nov 2024 01:02:21 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=e1P79vtm; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 8C0CA40424; Thu, 14 Nov 2024 01:02:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CVRqiNnP+mB6H3lfz3KCO4bHP73t5ZwHzAjB3G0p/vhMS04hJfA+PO+8br+FiWE0Rx0SM5ZmBep//nvgSC0rXdyC0dul6rL/hO92Itg9hNdmbgUqOZai6JJNdVd0W8RvP4DnOQMqkAl0Bo4wAoDLstURRCh4Aj12z7KVAH/oIm7KHcqRPAV+AZabPu4FlQNdxen38U3MwFLFB68xtKgDfQgNcpiPS7ObUp+RWf4/r+h9+VYLzWV2HKyvNE1oheo5XoS4CH0Hk6r4bsDQEuh/id2o+W6ibeazjhH/NWsVy3CajA4ilV5wQmLg2cLUZ0rpX6ljMxryVcLxQYsYl4NbyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=GqL8/oKnzCuF2Z3LGMS2Iq4ItonGZ5ovjU5dzrsFR00=; b=Q/rwih5WhW/X0ymLQLbeXom5w7LwKjfz33FR+CB0fT8wGWsMpmpIVWUtdPShWjeNAIlyAOKqyjzP3iQDfkQ20fFFlUdoekaStADfTu3fER1g0LZlpJ/0Yo/P5AikN6q60qlCrsL2+PfWOd52VRa7gQdfuj6hsQAPAkFaYEq+HyKpf9qfBoasm5SbF/wT37lRD1HJRnldJMqWPv0WilEVxzwMjhwAsmxy7VZGGoQRZddo2MQnDnlEE9v2TLPjN/DzPQRZhsRHUVCC9mJDxYSuaqtqQ6RUToEaXQhUSE6PKobjqrSg2VV3fCFHFh7Tpb/c55N83UKK6CkmS6uFTidFUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GqL8/oKnzCuF2Z3LGMS2Iq4ItonGZ5ovjU5dzrsFR00=; b=e1P79vtmKks+3BHRfl+6HVCueweNnde+Qe6DK4JoWI0gzNWFOsytEDT5//NNrOIm9YPttU3aHUyt7yZJYTpRuwn+4l3z4yTWKfsQjTyJovNhj5epO8QcVNdwPhReq1A5ns5FDSG8wRL75sMRm+2bVTHBWcrvSBy2xC2FdBWw35A= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by SA3PR12MB7950.namprd12.prod.outlook.com (2603:10b6:806:31c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Thu, 14 Nov 2024 01:02:18 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%4]) with mapi id 15.20.8137.027; Thu, 14 Nov 2024 01:02:18 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , "linux-usb@vger.kernel.org" CC: John Youn , "stable@vger.kernel.org" Subject: [PATCH 3/5] usb: dwc3: gadget: Fix looping of queued SG entries Thread-Topic: [PATCH 3/5] usb: dwc3: gadget: Fix looping of queued SG entries Thread-Index: AQHbNjDaKoOF76BebUSIN2kMbnoZ1Q== Date: Thu, 14 Nov 2024 01:02:18 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|SA3PR12MB7950:EE_ x-ms-office365-filtering-correlation-id: 255f6e3b-316f-4c39-9cdd-08dd0447fcca x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?f/tFAhgYS3PtJIgZQr7Nv6RhH3?= =?iso-8859-1?q?Zn8JjKPEB/ZJOkT0kOqQj9F2WB6c0tf94gNdJxHYoiM8CLC1I6kEUwDYCBxE?= =?iso-8859-1?q?C8tn5UJFljQ0/3iPfUD382iAuVK3pgUxCLmVtd/GBjuaa9NGX96j0MrX7sgg?= =?iso-8859-1?q?K86+v9EqJ3TjIBJxwf4D56uxrirRUrtHlufdnPC48iUJaeFfqePQSwZCDgNO?= =?iso-8859-1?q?59AzjmZE9G9QagHWYrqe9U5DKleAWyVtVw1V7HCdvFN+7aGJg2HDky1mmRmR?= =?iso-8859-1?q?sSclEibb1mR32bT/MItI8vwMvHs/cjRLrTxk9jk/FudgGIamXRkXbe0SLReP?= =?iso-8859-1?q?eSV+B6h4ZLqdIoY3GVuOhVAVfes5XdA0Tb8HeVjYg5Fek/grn7Tr7baMQUsv?= =?iso-8859-1?q?y8tovvuBJjR/4TDMxTl/lK7AeAXOfgPEvfbhqShjWE5Q0woaL5RKW65VCJYG?= =?iso-8859-1?q?7n7GIGWquUa9tQNicQ02Vtlu79/kIUcrO4EESZprf3rKOQ8mx/QPkIS60pbD?= =?iso-8859-1?q?hxGUHL7BHS+gCJ3/fNSnZG2JIGqOsFW2Hm2u6rr3j5HjQKcREDsdOK08JG6f?= =?iso-8859-1?q?sUdYkRboz11h6w+8qDuETYwpL2nFcBmEkhm8uD2BZxgXFKK7HB3c0F6fq7rR?= =?iso-8859-1?q?TNUOUj8weSmM1nLKOIjlPn+eYN2xaMpdI+tbrCXJGF/2VPG2JaPBnRSD5SXP?= =?iso-8859-1?q?ypyi0TbX8CkvTM5tk77SJmTRZpj6aoLKeOQH0ePtMvZxi88aHrxgDJVA4oxT?= =?iso-8859-1?q?X596uLrvLKsyWJd8odOTuwuR/V2+UgfKziXOSILGJUMYoFDDSLcxCaCNQrmj?= =?iso-8859-1?q?5ZmJNcaa58TxWcN/8pt7PpBCo4A8kQ2l0SM5F7cxSbyXTnX48FAMt9Pm479U?= =?iso-8859-1?q?obcESJO5PONxm15DfMHzrjmvLccLf/NqFaW5iyAeX5dkiBMkASUlw2+m/Thl?= =?iso-8859-1?q?J/i41qZ9UxF9WGxz9fiZyOu8qzlqgqephEKlmFlBNfT/VFp5mq7G/JABgiAO?= =?iso-8859-1?q?3728RBH9duKU4R24t6MqBh05NU6KdE2B1qNgkHNBQfkhB8iGY9i1yvdO3yNY?= =?iso-8859-1?q?lwnnRN47KEWeW/8jnmwVJz1oAetEP24jR2rp5dPULPdwZ2x+XdUOLbUeCvDF?= =?iso-8859-1?q?V3hojNrUIldY2AnkfkQQJf/k5wnI7mhQtJu6V1/EMGyDOhKYcyCVUWWw3Y59?= =?iso-8859-1?q?Muox9CvZckKaoChTVFP0kB03qPvE9KzyQZelAY7z3A3Elk4l3TQpc1iVkapB?= =?iso-8859-1?q?lx6/Xa1kwNRy6eaTPf8jkBfYRT3PuKE1e9GRyAO4x4cLHZ9CaDit5U41cihx?= =?iso-8859-1?q?+CDrp0TQ9NGIu2hr5NhR1waleOFRntUZlUvW3+6pZkOpxLxvDWnhi8iOsEZf?= =?iso-8859-1?q?/R1FXAFlijZ4V1GnR6TJMf+fDAh1xa2Gk+STtX03k=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?HfYiaIuqFog2Udc5SRyH4Dg?= =?iso-8859-1?q?1HyAu3SeVg+3AAVoRkIfavUa50kiq4UMeYgVOFEsaOJ/cIax9QsAHZBJ/OFq?= =?iso-8859-1?q?vmMayxDmNJWcD+h8sUCX2REQj/Bdj31uS4n6dx5Pa6NF1ulsPgelHAEIc8Ui?= =?iso-8859-1?q?LhWqiB6sQeMfZu6lFLwJIznu+24aufBaOfC41nfqwmWkbxDgv2XxASN/838Q?= =?iso-8859-1?q?wm62eea6+4o9bA1BfF72DRjz5n46szvf8k0qt1kTi6r42NewDJaOnSHJQx7f?= =?iso-8859-1?q?Qvzec+w1diliXpXgash7cJVQKrMkJurd7Frm6SgYG7FgvpGT3Jg+ViYOU2xw?= =?iso-8859-1?q?RQ7vSGQZZiGNihzCQDDlKm1wAeJNImrGu/RUCA0q0ei2IxH08eJlY7JXj16O?= =?iso-8859-1?q?CD+cY/Y2OH2ZJSGUVyDfwq2FujUC9ati3H4yRVhbrgOYdZKUZEvIzvJFYkim?= =?iso-8859-1?q?IvfH4xU7ukP1TX9pXhT0uDIvtz2kpXB6IO+x9tqnpL9WWlpdsaAjla3h7dfJ?= =?iso-8859-1?q?PQ7h0gkFruaec7bb1F5RhRUhOfyBQ8hY4D1PZnrs38TH5S9emvQBNGgy1bHO?= =?iso-8859-1?q?NT0HUHhwgsKMMpf6u+ofFkpsJ31RUW64NoVa/MMeWAoxi0/ahWiqhqg40fQE?= =?iso-8859-1?q?vkpRbJNm3LiydU/wdYBhnPxWBcviWS4LI9gguqZ4W5bgHM50Cwu1WXkQ3ltY?= =?iso-8859-1?q?1Eb2kAI1Td6FBKGhw7CCpsUxN2bx+S8So9VjM/SFPc3e2GF1UKyuPZsUWp/0?= =?iso-8859-1?q?ml/ufE12FD4dNuCZ4QBQKbtQUpXJnqEwCz9pldBSKq29FbxVRuEuz4Rc32VL?= =?iso-8859-1?q?+sljkMXGP0iWASVa5iHEf+KzKIahNWW481A++uosmQuG7eI3j4sxr3RljHTw?= =?iso-8859-1?q?9c7v2AxaL/q5YSfZ6T2eHy1VpCDl6g2y2aHi5b8fG86XAdAf1N2+1ZwWLJME?= =?iso-8859-1?q?AoUrIORP+VMrMhy1IvpUN6Lb2w7Aa29ZaOZBigkOtJ7zHsRvpz2a7/CAFMzm?= =?iso-8859-1?q?fimKoLR4tGtqhYq5eyCv3z7HMEOT5VMHj0eU6pbc6A5i+FPA1oUWXfPFa6AY?= =?iso-8859-1?q?owqkdqKHmsHQCZPBTUxp/QOkav5UKFBqebmzusOLjx59cCj/bgY0zuH4rdHl?= =?iso-8859-1?q?duGEiaQNDvGxDEm2Y/ZX7at/kqobsFfRQDFJWRHhQb3VeH7SmrN4Iyr4HWL8?= =?iso-8859-1?q?rB5Fd1QrwVpqgzNQ31r8+NvBsZeuAiEAG7o+jrXRcv/KKW+96wQ+Lq9/AK/f?= =?iso-8859-1?q?WvGtUb7OLqdL2gJGava6HP4HAC8kj4MEAeaKQX8tLTtHRJZAUcYTy8I4ezSc?= =?iso-8859-1?q?RV6iDKSDdiStPyUhYoznCa6F+5vmDdL0Qyjjo8aG+TfUxKeVBIOoxBD7p/Ke?= =?iso-8859-1?q?dGH1t3VADQB6zcIL+SHOybJgoFzpzqjJh0kz8f6tvE83EsURmnAhm2Maom4s?= =?iso-8859-1?q?s9O7P17pcmB4Kv3IFBcJsvEbtWzl4gZhgNhFfmLuFVbh9Eb1fi3MQlBp6W8u?= =?iso-8859-1?q?WRRqNn/hGTe/dAF4jV2PlST+ezY1MzqJCiNJy0TfD25aDsbZZ20Iqvq6slqp?= =?iso-8859-1?q?mJiQunVXT82fDgLRaidMOabLaGFcUCmi5M154HAxhLxhWim6EKPBTF6Szv6d?= =?iso-8859-1?q?3k7J63lOorQ4OxV4N?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: GNKOFYQ0Y7PrHiP5Lu4+r0TODrSoxvzWCCmcW4923BxyETLSi3sRca4oAULho5kftzo04meZYZ0EF/7IBaTR4bB5KYf8PElt8wcwftu/LRAlnuABPPHBUcT94gALj1uyuXaXinJHpeuMqiYSDo6mIH34jPlonRFqpW0K/Bxh9Cmdk1FLnUanKmieIEROXiRMP7HX4TQqvDgtBIIiNwbTUmrTdsmURZH07aBsHAVBrp6UPXLU39myZccaR69EMX8OzPf+hKRVCHBRL90DWXqxfNyX9WAnRgBgntMc4vKVQ7gjfYuQar+SMH1Y852uggfoyOtpEfFCRgy8461svzf4aheXuMQ8OqY22+kN0fqjLhnyw/HjHHFAQ3LA7GUZy5GX083WG9HEIF0c0g6u4Hs/ouJgaZoz4WT2L7KoPfNr1zyhGAC5NWaW63wbVCrmBtYufmmmarOZNihnDBQJ+1SnXnhRqjUlsRIC/j5hAKv7tcO/74of9ocBawUNAFfPYnu7uEDhGGQR4srtZZw6dOdBJf4vrh5QSn+JxWvU4brUbvlRhDtsUVHLI8PUVpK8f96IB1UdpAVeD2sTMiTx8APGkPqCVjlXAYX/PwnUf44/ZjbE5WVfDoS9ebA0q05Mz4Sjz2Ay6apEveSuZFzBgbF4Cg== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 255f6e3b-316f-4c39-9cdd-08dd0447fcca X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2024 01:02:18.6708 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: FZ8Eo1/0pIuopUHibh1Za69ETGVF7GfaPuTVAP9Lu/Z7RH2NqolXAe7yhx4H2KB+EvELEUh17lRRXSMYUhBiYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7950 X-Authority-Analysis: v=2.4 cv=UvMxNPwB c=1 sm=1 tr=0 ts=67354c1e cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=VlfZXiiP6vEA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=VwQbUJbxAAAA:8 a=jIQo8A4GAAAA:8 a=G-WRxraSjgDgK3-KZ7kA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: 0F8NQY8sLdZpGYkm0VmQS6CUu3j2YFyu X-Proofpoint-ORIG-GUID: 0F8NQY8sLdZpGYkm0VmQS6CUu3j2YFyu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=919 priorityscore=1501 malwarescore=0 adultscore=0 clxscore=1015 impostorscore=0 suspectscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411140005 The dwc3_request->num_queued_sgs is decremented on completion. If a partially completed request is handled, then the dwc3_request->num_queued_sgs no longer reflects the total number of num_queued_sgs (it would be cleared). Correctly check the number of request SG entries remained to be prepare and queued. Failure to do this may cause null pointer dereference when accessing non-existent SG entry. Cc: stable@vger.kernel.org Fixes: c96e6725db9d ("usb: dwc3: gadget: Correct the logic for queuing sgs") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 38c3769a6c48..3a5a0d8be33c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1470,8 +1470,8 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, struct scatterlist *s; int i; unsigned int length = req->request.length; - unsigned int remaining = req->request.num_mapped_sgs - - req->num_queued_sgs; + unsigned int remaining = req->num_pending_sgs; + unsigned int num_queued_sgs = req->request.num_mapped_sgs - remaining; unsigned int num_trbs = req->num_trbs; bool needs_extra_trb = dwc3_needs_extra_trb(dep, req); @@ -1479,7 +1479,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, * If we resume preparing the request, then get the remaining length of * the request and resume where we left off. */ - for_each_sg(req->request.sg, s, req->num_queued_sgs, i) + for_each_sg(req->request.sg, s, num_queued_sgs, i) length -= sg_dma_len(s); for_each_sg(sg, s, remaining, i) { From patchwork Thu Nov 14 01:02:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 13874421 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A147A1BD4E2 for ; Thu, 14 Nov 2024 01:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546153; cv=fail; b=sVghIDL/CXn2RdZWz6VkimYMjNf7WclnXC0JaaLInCV8U3tS/GtDp9FkC3mRuQndvLoP3aRzdzCD3/G2C3SzZP1biOqjHoQ0YFPtRN2YKw/klRODzuuNQSDQzNKsT6Sd160sFDiq1yAUXrj+MXNtyuF0DI444vCnybjx/Afr9+o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546153; c=relaxed/simple; bh=FHTUUJ7qKEZA/q5TIky9WmrO6KJtNZEJrx1+RI4/bpM=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=pUMHho2hoN6a1ti3Qp9w21vB3x9yqfW6bjqvXQzFZXknkFULbKjm69MoLWCivTTc2ZvIz3WRxAhIo9gawfGqgz1IZXMoQDes6vrV23mza8IaVZztjZQ3t3gLdtXmYzisYTVgxRm4CB4KIc6fcQ2KDnZldxmZD4QNhnTlSkmNrjo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=VLRuEl9Y; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=GzW3awP4; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=XnmbqLNV reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="VLRuEl9Y"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="GzW3awP4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="XnmbqLNV" Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ADI8MjY025589; Wed, 13 Nov 2024 17:02:30 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=pCx4DzcQ1qvgYLFQfd70bRciH4JDFqV1FeqKAmaYRiQ=; b=VLRuEl9Ynmvn q23smoSdUxczOfuT/W3pJqqe8iCdIzz+KNx+S1aQqRApKiGohjLfrlGzxMs+fzO2 O3hkRgeraw0z7sInHJoFYv4ISELl4pBVcEqj95KD7+EmAhNE/YftYfmoZEqXZ+eg UZwLzR/UAknZtCRegL6fAOIfz2tT3cIvCfUsgaIIDMIXg9ycn2+c7AMjtfu1rTSO N099YRiAic+V+ynEpm0uBR5++E4dlh08h7hr5BpYaHNhApbzYgb1JeMavfPOY5xK GeFzolsIS/XSFHJW88PTJSLTu3Wy/2ZUtwBUjAqm7Tjn+Q7pCdO7iqxvyHEGOdXK RONmxM4wTA== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 42t78m26rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 17:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1731546148; bh=FHTUUJ7qKEZA/q5TIky9WmrO6KJtNZEJrx1+RI4/bpM=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=GzW3awP4faPQ07cuwPq0KtHrgZkLfS3/MqpLvRWwmPNQiK2Ltz3x3x8n0WkpNYUBD +x6WwTvLlMT6/0bLHxO5vT1mGq/2nxqPcndxo7Nu9XWx0ay3x1I2gdjBzNuDzEpajX LdML9S82aXTk3Hb7ZRaUVLYjEam9+2u44gExvySvOm4Mru+oL9jCtAg8X58HWzzPS/ Y7/w7aUSsCL61tO8vaPgV1DOZJ3kLutLlYqGtBBwuadoNDCR56Fqr18Wsw5HNdRHY8 2s2HUFRu78aeT6yiWPOOkfGmGv0/TFPL+/SBqhUaa8mkHry+a80GsWIsUqkZBLwsHf GVPpjQ4KaIiXA== Received: from mailhost.synopsys.com (badc-mailhost4.synopsys.com [10.192.0.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 6CE1B40107; Thu, 14 Nov 2024 01:02:28 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay3.synopsys.com [10.4.161.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 38FFCA006F; Thu, 14 Nov 2024 01:02:28 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=XnmbqLNV; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id E1F9B4045D; Thu, 14 Nov 2024 01:02:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qc3urZxiro1V+qcVIx6diHIxcNGVPGihR0AHFq7y9/qlk+Ko9CBGBTyedO4lbyFiD/uUEEQXLhQLyG+FY8QK8QS2rlBzgGg1vwro7fznO74o/Gy+gBREZ1CXYriBd0Bd+oftmTT/IZcJ0v749LP0pwXpzmXYnv4DXFB62d5Zh/Mc5zMioO1VcQEHPEPLu3gDlR8XHzgPsh7Cwg1D4IsQqHTQgl5NLpkQtwd+4IYmoZpKoUNnKBUNgmHWUbivEt9jArchPO1EMy6pjLvr8YpilMAoGgiu8XsNmsmwGNyHMYbMqVT0a95AHWS4QSZ7mP6zOTLuxV6T2zeQCOSXPYswnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=pCx4DzcQ1qvgYLFQfd70bRciH4JDFqV1FeqKAmaYRiQ=; b=IJxspEx/4iW88c8UIqmrDGyi2SkCbP9pYdoGhrrYExSvYhBQCIwQh6GCrdun/EvUkblrEaz03rEyUDctjtRF0bO4tV0t2nEFb6KyuQhXrUT95H2sv0T2+7NLRvTRoM4NwRH638RU18qiqTC2ABREHlc/3HjUb0aoZPMpCbFTCqbYLjIx9yz/91rzS2ddGZtDYjZ9iuMkuOUzAnyMrLIXqoRWT8ysrJSzGHbY9MJgXz3cSJrcnBbV0qm3Q4369HKpTwmAlMw8SBJcXyxFmSsthlk5iidwLoM7ymFm20PjcpduIQw5aBscnUm5jA9SiY45T2vbL9A5bP2DOqGI1PWm4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pCx4DzcQ1qvgYLFQfd70bRciH4JDFqV1FeqKAmaYRiQ=; b=XnmbqLNVfvXQdsNRT1+sBu+n4F52u8i+mDKXDPdyeRv3qd5bRCHSjcEKhPA/VYydJ1W7mQpaf37/jMazRnqClJ4eXSLqd+QQjGhsGdtHSCw+P/cleTkhlVia5+jaRw6HBTa6vMwgHLmK4A1T6lO2PagNMLVejivlOFr3/+Bas/k= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by SA3PR12MB7950.namprd12.prod.outlook.com (2603:10b6:806:31c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Thu, 14 Nov 2024 01:02:24 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%4]) with mapi id 15.20.8137.027; Thu, 14 Nov 2024 01:02:24 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , "linux-usb@vger.kernel.org" CC: John Youn Subject: [PATCH 4/5] usb: dwc3: gadget: Cleanup SG handling Thread-Topic: [PATCH 4/5] usb: dwc3: gadget: Cleanup SG handling Thread-Index: AQHbNjDdzdsm46mJS0eT4Iz6c7PlNw== Date: Thu, 14 Nov 2024 01:02:24 +0000 Message-ID: <96c7bf8f6b3e91e607d5b78ea51cb1d00c614eaf.1731545781.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|SA3PR12MB7950:EE_ x-ms-office365-filtering-correlation-id: a232daa4-4c20-438c-5dcc-08dd04480065 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?YHFv+bAtYHXWbUhIZo2gX7rckr?= =?iso-8859-1?q?nHeHlfiIDAwydwPHd0lVcZ+BmS0Bwrx688ZAfTYnpg/M8oDYgJuMFoojlo28?= =?iso-8859-1?q?YcCcOSHlN6Bt3Krd/Ch7Kf+fgrl5S/B1S7JHxPKtpaWmvndQok/qDB2LibmQ?= =?iso-8859-1?q?Wh/nvfBrcuqDR3jTj5hBD3wP7smf6LTUNwzd1U69RGmV0aFDMMjQEnAcdMcr?= =?iso-8859-1?q?Ik7gPI8dcxZPAzsOYs0F/H6fnZcwSKOUdCss7eTjc2idcq98Pf44wAE9e/nV?= =?iso-8859-1?q?oE1dy7NEgU1qBWw1w0AfYaP0MXAeLW8pIvE18xXSftptj3p2X4tHFCDx/xOg?= =?iso-8859-1?q?v/aQ7CaN5d+w9+cPiX1oG4phNK2s6G2Ee+W8UjOZKOG2D0tAmgSj+52m3aKK?= =?iso-8859-1?q?Yydi4z0XqnaIAHzzlfXdKYZ4MEICXcs4cAq3l75Ui5mNw+QiB70iN00q5bWF?= =?iso-8859-1?q?OosLgYIUZy/d9Ys8jSKkF8TvzQMMQNh9JYqcY1BM9Z+Dd+sRRppvifYMw+Tr?= =?iso-8859-1?q?k4/MHknl7A1YfwDEgmO/4I1rPDG/hb0lo5RbODyXoQ1XBJeHO3XuF5QlBdHs?= =?iso-8859-1?q?xxGWgKcpc4w+6FnZ2uBiQ7CaxfYrrSy6FZglUnwpOv0gSHZpmb4zpFxOvK9b?= =?iso-8859-1?q?3uaeamghLTWCFjt4u84EL5avY8tlH6v18xUZ1LCBmCDFzsDNkCC5pD6isnBM?= =?iso-8859-1?q?JFHnh9II0Iy8lLnJElyEySDqbVSmaGSJfpedv7zapc6ABTvWqF0ZvwjsWOXT?= =?iso-8859-1?q?QmkLl0C5Q/TVA1gg2woMM142ZAjAmeDKwyNXe26rtabM4uCBJC6QTZ3qA3en?= =?iso-8859-1?q?HdbH9KdUc4jQGt6LUAyfFPAUemKCSRnCGm+zzepvmlkzGrNc8XPNUrtq5WbK?= =?iso-8859-1?q?EIm7ZY6C+tucu35FilE2UJDlU/mj7TKsNyiLpxCGrjMrlekoO1A/rWcm4yQC?= =?iso-8859-1?q?73hU3xqLRaYHWSBVPKvFwh2WxogxVkyPtusDyjw/uvIkAIAsIL6NC5lKV8eo?= =?iso-8859-1?q?7rRPcYZclY5+y9/RUyrA9faFrPDQ9Jkjn+T3sY1btvtTltOjsFFZju1OAbHp?= =?iso-8859-1?q?px384bf/RzmaLbUVpWTWeZnxlwCvbdYIwpXkMumEa/jYHRaQ7B+vCxxw0ltr?= =?iso-8859-1?q?p900DiHzm//+lrdufNNUfiXOptmj/U2C0YAek3lWRkrfzjNsUQns7lOLooay?= =?iso-8859-1?q?xwj8CtPsuPKAQHWCqdt2Cmf+mu1Bu26f0eT/22kFuXYgwcCFvskU+dAIT3ly?= =?iso-8859-1?q?CSKt4tKufF2yKzBhkZ+fTJeKnkOh6ZPIvMap9X7Xfw8+2wC90/eKPxbAkCSW?= =?iso-8859-1?q?7fFkEyyJ03mMOFheevgKA8tPBo0hCy/j0jFex6/tGu77aHsIFQPu8CJc2l6D?= =?iso-8859-1?q?4jvyjsLzFW4YQjNjT1kyJqYcp43QDMfnG+I0GsGsM=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?2kBK5staA9RHlOIWtaq+3gt?= =?iso-8859-1?q?Pqk5mjJKSw2XS7ZheChsyfyTK/wP7z9KXyMzbqJ6zttH9w+lv9NYN38UbrVv?= =?iso-8859-1?q?pnIkVXXnoolw78F3HBiK0+N53Abmhqcym8iaKnFEvEdqznoIL7SYvjcm1R9Z?= =?iso-8859-1?q?28KCvcvVQlTzFkEoTPmSQKw6C2sSHfYrjxDYYZSAGXyFvOaksul9GqBi4GFb?= =?iso-8859-1?q?TDmLeBc77eU1GCs9Yhjn8rjJxhmelcI4MrXMRkQQgB9qfu0J5Nw2ID4tsJ+3?= =?iso-8859-1?q?TAAxomEAeH2yMuuGDbljzigI6TNkMLMJS1y3VtU76RZsVMHgc06y4yLgVWE1?= =?iso-8859-1?q?YMnR/szgFUJndCjUom1nfzPhBiQMgHbp7sNZqd+hX4KPFUieyGDeUWnYtgEU?= =?iso-8859-1?q?iJyjuUPGtBIrsSYfyvkbZDFqMxJNfCcYAOEiFULu6SIiH9xgzWuDsLDgOa5F?= =?iso-8859-1?q?uKCp26c0+Qmiv/oKKpbQpeR64n/tH0OK3LZXTw3+7Gp4dZ/+uJAwcjtpd91E?= =?iso-8859-1?q?t2mZu+IyjT+7oXzjwp5DqQCxA7TIlamf+2KE7PJk9q9TK6BD7G48poJlXlTu?= =?iso-8859-1?q?kRRUeIAl9xcJnBIqF78aSty/nBrKBF7qT8Y20r/V5nDKHuFqMCbeqLmvMk8A?= =?iso-8859-1?q?vpYK9c/e9vtsCG9/YDv9xepe0rG4QPEAyl6xnZAQ5OFgjwtzvpzytWpctgWF?= =?iso-8859-1?q?6KtDVB5F3TmOeilq+h3yt/RRvKQkmEpPCxabTjDNAl7wYJTl9YRccBTjy5eH?= =?iso-8859-1?q?4l//GoeIDzk7Rn7Ed8d/zhcDyBJFUGFZAWzjUZdrtQa5aJO9cTnEWqKp0c5Y?= =?iso-8859-1?q?gr+KAcaOyl5vM8A0rXQwgAVclnXbcX8uqFt/RjUZ4hIacWvuHnq6Onmj8YUH?= =?iso-8859-1?q?SSSlj89LTGC1QaMBFheLCR5unvt62n1laUI4WS6ArJbKez9zf70gqNrdktRl?= =?iso-8859-1?q?UCfdoJk725LljIGsS7EWXIHVYMMFlJlhrvtpqysvMYBgLevswpYAvKBxFT44?= =?iso-8859-1?q?j5DmUxZbeYGqozNBj10bF4hMLu9fwjRuWwUCcTxXwUDDGYBmKBJ1Sve4lvk2?= =?iso-8859-1?q?URCLzw57uZKRBg1L8Z/BI7VPHD7EfUnuNv+7WHJmuKQYLOXndqeG/32G2Za6?= =?iso-8859-1?q?B8rIyAXr6bFEJvEqm51/j0HotB4257XFYmGSBTbJ/KgEPXUN+KScMK280VWP?= =?iso-8859-1?q?7pB0Az19TSU1L2O6ph+NCMkjX7wyUDms6ApmWuwpdv3MqpuLBV00b5jcrsLU?= =?iso-8859-1?q?osIL6C+L8mwgaVzTejZLGchwmazfBk1ScebGO9dkTswKnNmNRIwnn9erkawL?= =?iso-8859-1?q?FIVBcWQLv9+qqudntkH4M7gJ+pETq5zHFxRWp8LKM1Kxh1Ire3yJdFRpyz+O?= =?iso-8859-1?q?BrDb7cP/UAlrnuLNbTlhWdCcafJ9G3j4EhT30cPcwMFl013LRG/o5a2EAMYl?= =?iso-8859-1?q?ZVsfSZLos9au6ds0sap7I/silNC9dcCesezO6unP2ooZN5Hm0+rXD5Aadhwh?= =?iso-8859-1?q?ORTV2KFhKSObKpian69pneCbGcU/rCBr+FmRM3fSC5xOgY3cJ8WSP5JgV0aC?= =?iso-8859-1?q?5637hiN3Rdi/5nqW1/16iujHYHMFLSM3KpXvLOhu2xZo36oRdM01YbZXKxg7?= =?iso-8859-1?q?/KhkplOwycxaD1Hzc?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4/7l8tm1II9UYKHsGtVsLuWg1fg5ubMySc0ZyKeTPCP+inxjHpM5PJi+YkKPxYlNI+MNIJd7oM75iLG+WPooB7e5pSreeYB9+OAeajR7a9VYdP7Qf3OCWAcwz/csbRjhA3TeAH1iuNi0GupFOcEJkbuckQ1zhc8gwMUIo0uceaUx1lpgq/LhEam8qWjexTPeLw5v6IBj8APISL7oYEWmctPMZDXvtumQxFeTmUW8WfRJBxxDdhVmZPolSDO1fafIsXrIPgYDDHm1GKRKE2zOLK9QBMOvsNFP2NfUcvpsXvjZK5Se8zUygNrbyyPF1i0ticpJgpQ2W9XnuezKUAA8b/+sdZAVN8Tt8Du+sej7H43YutySrw18KpH9Eza8DZi4/rR21H49WffjpMewADyBI46AgqPlRTYIBlAXP4kp/htvLjHJhB0DOt9H0+XhcQRjtmhCIWZr30nEqWHw5o18J2mGriPZFsfVVyTr/j28cUuMGEfpOBges6XNVrMm3EKJwYdlSs2JG20I8ZeYOdTqIHpDACf5CiMaUXWN4PMsb62EXDRhtAqfv/a1Vqyso8hDLMoZNblcTZ+SgqC+r4nEYT/0o2xvjdkO6p5BTltMuiANqc3WR2XGD2n/+PNNMRJYLgMz8UkqO2qbQgfKftIe+Q== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a232daa4-4c20-438c-5dcc-08dd04480065 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2024 01:02:24.6767 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9azI3k6Or2o2KD0fiIHyPWG1WJYRZIuSACld5Va8GBEcERkgJrMCTUoCOk4++dmP8MFc0YGlF3/HQSBdZfB9dw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7950 X-Proofpoint-ORIG-GUID: lYUxVgDzwscraqvXiDJNNkbgMeermTJ2 X-Authority-Analysis: v=2.4 cv=NPuH+F6g c=1 sm=1 tr=0 ts=67354c25 cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=VlfZXiiP6vEA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=9dXq-v3q9CYHDsQcqtMA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: lYUxVgDzwscraqvXiDJNNkbgMeermTJ2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 clxscore=1015 mlxscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 impostorscore=0 bulkscore=0 phishscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411140005 The current logic in dwc3 driver is tracking req->num_queued_sgs and req->sg. But they can be checked base on the num_pending_sgs and num_trbs. They are redundant and can complicate the SG logic. Let's remove them. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h | 3 --- drivers/usb/dwc3/gadget.c | 42 +++++++-------------------------------- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 2dccd8fa7efd..aa09ccbf34a5 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -941,10 +941,8 @@ struct dwc3_hwparams { * @request: struct usb_request to be transferred * @list: a list_head used for request queueing * @dep: struct dwc3_ep owning this request - * @sg: pointer to first incomplete sg * @start_sg: pointer to the sg which should be queued next * @num_pending_sgs: counter to pending sgs - * @num_queued_sgs: counter to the number of sgs which already got queued * @remaining: amount of data remaining * @status: internal dwc3 request status tracking * @epnum: endpoint number to which this request refers @@ -964,7 +962,6 @@ struct dwc3_request { struct scatterlist *start_sg; unsigned int num_pending_sgs; - unsigned int num_queued_sgs; unsigned int remaining; unsigned int status; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3a5a0d8be33c..687bb8cc4114 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1544,7 +1544,6 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, if (!last_sg) req->start_sg = sg_next(s); - req->num_queued_sgs++; req->num_pending_sgs--; /* @@ -1625,9 +1624,7 @@ static int dwc3_prepare_trbs(struct dwc3_ep *dep) if (ret) return ret; - req->sg = req->request.sg; - req->start_sg = req->sg; - req->num_queued_sgs = 0; + req->start_sg = req->request.sg; req->num_pending_sgs = req->request.num_mapped_sgs; if (req->num_pending_sgs > 0) { @@ -3472,20 +3469,16 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep, int status) { struct dwc3_trb *trb; - struct scatterlist *sg = req->sg; - struct scatterlist *s; - unsigned int num_queued = req->num_queued_sgs; + unsigned int num_completed_trbs = req->num_trbs; unsigned int i; int ret = 0; - for_each_sg(sg, s, num_queued, i) { + for (i = 0; i < num_completed_trbs; i++) { trb = &dep->trb_pool[dep->trb_dequeue]; - req->sg = sg_next(s); - req->num_queued_sgs--; - ret = dwc3_gadget_ep_reclaim_completed_trb(dep, req, - trb, event, status, true); + trb, event, status, + !!(trb->ctrl & DWC3_TRB_CTRL_CHN)); if (ret) break; } @@ -3493,19 +3486,9 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep, return ret; } -static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, - struct dwc3_request *req, const struct dwc3_event_depevt *event, - int status) -{ - struct dwc3_trb *trb = &dep->trb_pool[dep->trb_dequeue]; - - return dwc3_gadget_ep_reclaim_completed_trb(dep, req, trb, - event, status, false); -} - static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) { - return req->num_pending_sgs == 0 && req->num_queued_sgs == 0; + return req->num_pending_sgs == 0 && req->num_trbs == 0; } static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, @@ -3515,24 +3498,13 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, int request_status; int ret; - if (req->request.num_mapped_sgs) - ret = dwc3_gadget_ep_reclaim_trb_sg(dep, req, event, - status); - else - ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, - status); + ret = dwc3_gadget_ep_reclaim_trb_sg(dep, req, event, status); req->request.actual = req->request.length - req->remaining; if (!dwc3_gadget_ep_request_completed(req)) goto out; - if (req->needs_extra_trb) { - ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, - status); - req->needs_extra_trb = false; - } - /* * The event status only reflects the status of the TRB with IOC set. * For the requests that don't set interrupt on completion, the driver From patchwork Thu Nov 14 01:02:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 13874422 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F370D1BD4E2 for ; Thu, 14 Nov 2024 01:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546159; cv=fail; b=Hgmco5OmWJmrN/xJJckdzOBNf2gTNjlz+D6kuuVHlz56yCEBh+46PJ1LpCYS1BJDyaW5jytxqtSlf7gzy0vg/kS9Bg4nAypyrrcfEJwPkoUldzQBoqnoKuI4o257zsv97yLXYcHq0b8e+bXPxx6TrwYqHToRDryF7Z3MyNF3n2A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731546159; c=relaxed/simple; bh=jQUTHCaZneDB/DfGtKWjIVjcoo+UaN155TL/6xhUixk=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=bzi2fBQTYAnI/PFtovdRMNo8nyV7/QdbNIyFgsw8LAO9yoG+P8rPWQVfsKbVvdhk7rFeuXf3mNNsx/RuqgMg3gvq+SIReBkVAjK3mBdktNKPW50zf+H1tjs984jx6h+BQQiZSjKfdyDSlU2bAIpoAspQwGQz+tkZbel+r/1actA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=kkJznl/L; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=cfO39Jdh; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=qhWZwMJw reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="kkJznl/L"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="cfO39Jdh"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="qhWZwMJw" Received: from pps.filterd (m0297265.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ADMcEw0016957; Wed, 13 Nov 2024 17:02:36 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfptdkimsnps; bh=oZ/q2Il1L3TJ8NR3L+XWQgf8rKBVgkzUBDxR7BZJA9Y=; b=kkJznl/LCjdU GCiFDo4Db9pjAtZZg5dyFY+p8b3iVNNm6nH9FsQGzAk6pFEgwcLbjIYQWsCiUUj+ A+qIkQK+UHkME26f7isLaiJgeX0o9kK8xvAn0OasSgTaZFmXC5ZA9OqfHqssf4+j V5z4OGeEvlByolno5N0F1nZZU/0H5k5G9EfL0PPgZy8lIhCduXAUOTs3/6mMrZC2 +y31byRzlJ6XQHtnqF356sxO9C5khpGY5CusQ/+fMZsq4J1ymot40nytB1HE78dJ Hz2kFhBKx5bemgtUnG46YVyx8ODWyJlYRpmSJznt08GI5SaVghNs9LTRE1hPeMlo FYDGXJcU9Q== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 42w52s8ha3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 17:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1731546155; bh=jQUTHCaZneDB/DfGtKWjIVjcoo+UaN155TL/6xhUixk=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=cfO39Jdhsulvh2QvIVYLENoe3J+sf/4q7twaAdQtPdqHNSBe+cYjDnQuWQg424mH6 H/oh7p/vhg/CLFX49WfWSe2mtoRXyq1aunbMP0gofgYwnRyCG32ETbmW2eLnwVmvU2 fozVNvb6Lixg30x+9usiNXeY3z1uEwewvTBXbZVh24+wOJ7CX6jc+dLMrF4cyb70Wl HEMGtQPfP5Rm8CdDFzmn6HZ7Uyyisro8b22gGPZplCVFBfIsHoLwx/vTGKFwsmyV6c RH+QS1qLBnoshNUsnurno0dYTBmsowOfKQ5krjjwKHOXNPZtWsbLCZTIG6J9T2Erpn QCms8dZluzlQw== Received: from mailhost.synopsys.com (us03-mailhost2.synopsys.com [10.4.17.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id D5F4540126; Thu, 14 Nov 2024 01:02:34 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay3.synopsys.com [10.4.161.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 9DEC7A0084; Thu, 14 Nov 2024 01:02:34 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=qhWZwMJw; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id 66C7740424; Thu, 14 Nov 2024 01:02:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mm0M6bxbdgBAAKfEgV36M5wwdtFsR1/bfGLYan6qcpiLvAySYJzOJhwZOLTk8lJU5QjnCsH0lAcGvR8zHF/E/Ai1U/pRrnzrbAnhgesfHL6gChd9icg/A0bK0jqavXiMIVZfoXC391JexCC9u/I1Na0QGcCeG/o9iH0hl7udFnDiFqr1yKvBLHhH97KIQeZzRb6wHIVCE25LQpEU78XsMUuVgAqxJyWat7djgevLNc7TB7arw6Zk0AD68DqBQsPIncm8hYIdZwrlQvf5XDXvu2XjASfC44LI6ptN93sUpb3PEbBsjMXgLw5Eg8n6VvmnGH6BnZJ7VA7pVq5qYO9iig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=oZ/q2Il1L3TJ8NR3L+XWQgf8rKBVgkzUBDxR7BZJA9Y=; b=FnEdNrGFwROlbJNLCdKG5quRyj2r2K6KmD0byiB89A6Kh3ZT+o35wdl4Zmvfgg70L7E4FeU5nSWCjWG9y1U/3c4XrKMNZ5Uy2V0NIG9K9ea/1R6EdL9XzuL93bsXgWt8UMla5UQm18LL90IRvpQ7mJmDKLcJpOuB2tTxI2WbNu5Ne4jRMWd+ZpYCaroLfsWvdCs0W/7QKE/O/YK3WHb4+zrcTsEv35PdLJ0+tM7vfTf6P3oqyqY8kHKaY8deaVv8E+Vh56ANPcsNEbQKZ1URP79tFxobXN0bJBBae/hPHGLjnPcfiuM1FRLdVyJT+QadL/gGfL+hLDyBkCmuwAZ8IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oZ/q2Il1L3TJ8NR3L+XWQgf8rKBVgkzUBDxR7BZJA9Y=; b=qhWZwMJwr7yqfk/+8bewVrhGQv5+/lP2eSupMpAT4DTXpHflQLK92YSQ4WwnnHki8XqR2dS+JoeRcjSlW58ZTS9UfcY69r/xKDZO6uZSEuXz5QGxPVEMeEP8YXJxQBvD2k1uIl8VguCqxedmWFdWpYtAm6knExx2LY+BS31tsEc= Received: from LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) by SA3PR12MB7950.namprd12.prod.outlook.com (2603:10b6:806:31c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Thu, 14 Nov 2024 01:02:30 +0000 Received: from LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8]) by LV2PR12MB5990.namprd12.prod.outlook.com ([fe80::3d09:f15f:d888:33a8%4]) with mapi id 15.20.8137.027; Thu, 14 Nov 2024 01:02:30 +0000 X-SNPS-Relay: synopsys.com From: Thinh Nguyen To: Greg Kroah-Hartman , Thinh Nguyen , "linux-usb@vger.kernel.org" CC: John Youn Subject: [PATCH 5/5] usb: dwc3: gadget: Remove dwc3_request->needs_extra_trb Thread-Topic: [PATCH 5/5] usb: dwc3: gadget: Remove dwc3_request->needs_extra_trb Thread-Index: AQHbNjDhMgwt2K3oO0GTaYtg7vPrHQ== Date: Thu, 14 Nov 2024 01:02:30 +0000 Message-ID: <08dd88a3308ac7894267c52340eaf0e1564bbf36.1731545781.git.Thinh.Nguyen@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5990:EE_|SA3PR12MB7950:EE_ x-ms-office365-filtering-correlation-id: f938bc2a-4e4c-43b2-638f-08dd04480402 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?qS4oR3n97X+y3J1HMuU3/HBC6U?= =?iso-8859-1?q?/2f0JKxdikzLttNO1ReVv2daH8eXgz8abjyrYR4QjK4S0OxUuEdKlt4DXWIg?= =?iso-8859-1?q?7qw3bmQ6HW9A2SipcWNfr4M0R1EDZh7c9XHAaDXB3saHKvtI8Y1ien3lzRzB?= =?iso-8859-1?q?HKbZxo6tNJTfPqFHmCcZbeMUqyHlszGNnCN+3fGa8BFTI5rYjLCd9939+qLl?= =?iso-8859-1?q?uHX2zEyD89nKJ2Vdf3fKrqfb/PXMmeFYPgY1hXEKdGdrYqls+e4awlyKV5WZ?= =?iso-8859-1?q?2NC/PbuFVspkI3rauNyN09yUbFbiYq7nIclpUEMYcrCt98BkVMSYsg8EO/tM?= =?iso-8859-1?q?np8onF2vZFm8KdvaqQCpLUQhumj8IZaLlvFUfdFHC2tAlohcAfPLrljcoJ3H?= =?iso-8859-1?q?LM6uUsLS+tcw884Q5fJJoATNJejDMtUOpgSVk0ZHdUR+wCiBSs+MsEvRsx6P?= =?iso-8859-1?q?Dj1g6APZZwmToAiwXtNUl0FBBS/gmzbwbt7VVfeh0n4Qi57QxWpRohFefx9W?= =?iso-8859-1?q?SsSSblOOtY3+pSjl3Qe46IigQUORiKiCULRNxFs0Fdc5mwQNQSp+I5Ydp7ne?= =?iso-8859-1?q?7RuYvl2fZvZ8YZuskeKsOZn+hw/ss1ZvSoKWkJ8x/sFcuGSB0uq8OU37Agex?= =?iso-8859-1?q?5wNpcNJX7pNzdGUlBR7Tzydxz6K3uwfJr8w/2hzAn33trUb+rPwSNTfA7xrh?= =?iso-8859-1?q?2bbty1G5u17FeOCh1WZe7CcsbGDohL+DkxRsfDbGLOsyUg3XwZKR5R3ZT2TM?= =?iso-8859-1?q?QU1a/VGU3ADgEsp2LjvUENsm0G516a0ozV1Iw9tgJcWlKkqwzkyTwwIkfMUr?= =?iso-8859-1?q?RLsrCUlPYlIdyn7g9SDxY6bj6rChUd/gf7o18LfyYFOOnhN80H0nKy3aGnO0?= =?iso-8859-1?q?Dw4PlQoXhfUr7Q5oCgKJvbDR5Z7lVEewJt3z7JPg6E2vzams1tBexwmvZfh5?= =?iso-8859-1?q?/f/X0VPap1gZBO1Q1HgtGiEACh/qPOLWrP0zrbRfzIK2aLY1SDDG1Q9425/6?= =?iso-8859-1?q?1GIkvsQAxoDO2k/jK1/QImNIQzRjMu5oGWNyLLzqXwxikkSA2lCbNOozO3gw?= =?iso-8859-1?q?ckgQWVeo9aH/ZyV3fQHafV8qae1ELxY5q2eOAb6/iZsIv/VstmESqT63UJOB?= =?iso-8859-1?q?bc/sZ0F8NezuelEtVTWn8mOdzvKV6/CYVjYTQHRiY8xL8PYCvRz3fjM/sQ44?= =?iso-8859-1?q?Xhyl0xb7Y9voGJHDDgMK1UMrFNohxAP4eib7o35wKD29aAN6qusO02uzquZS?= =?iso-8859-1?q?hzJKK6d4H352JfLmrCbwoeVzjoTzGVH6Vu70azi4zyl50DltPkrBXSXBniGg?= =?iso-8859-1?q?FCotXP27PSrvESHF6Q/Pt7QAyYCCGItqbusi5WSTyYOOCR17DawRie9dJ+Yd?= =?iso-8859-1?q?M+H4qDkO5M6STPEbhsQUKJLBSlAggDjxKLx9kqciA=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?ObohOE9lViIv+1KGXZinEgB?= =?iso-8859-1?q?fMpzL7xfHVFi+jYxcYHtpoqyPPARNZOY1x2yTMDH+8hu1WPIySE5d42svqMl?= =?iso-8859-1?q?ldFLJm1UFBJpHcPDrsY7GFcrVPTDEEf94TJHzt0ZISE1kIAdRkLNqVYAT4U6?= =?iso-8859-1?q?gysEc/YLXUY8q2PjoF9ZZCFGhnqJdnzzkEzB9TXvB2fhiPdz5s5JFGIi2im5?= =?iso-8859-1?q?GPprIICUAxTh8gdbA3qo3m00LmoNc+qgVNZDRyhYuhs1NApdam/czcxuaQor?= =?iso-8859-1?q?MVqCxKQZS17fDFHZuLzg6oMt7WupXS2GXppI65Y9inFd+JWuCRvcJ1R/OYks?= =?iso-8859-1?q?W7nElw2hb3zH+yriu4ClzFLQp9Fa2RDSIj27dbS1DHubbqUgOuJByDPp7Hln?= =?iso-8859-1?q?+IfMwjzo9iwO/6PtOT8GNwGq6eTYPvoD6NmO8fyfGyTGpxrKsBjLf45ndwYI?= =?iso-8859-1?q?3WmHarUyHIuOC8wU8AacMzDCerGuqmKXcEBjgplx4A3wOB7605I2IvoH/qZq?= =?iso-8859-1?q?pMjim3/OWsTvr6/q144N/3y8uOtc0TvOhMpXWR8rLFDWdUV+Cv/jsYMPIGzT?= =?iso-8859-1?q?m9k2X6IBFQI4cblwIHVae9AQY48QvK0mm20HEVFGNDDsn4t4E9eh9AI8/ONh?= =?iso-8859-1?q?qBXUA51y3Bw/IsKW1jiLtybzzKDsN7u9XPyPV98RhVjwMk1Tg/a9wmtj5jxG?= =?iso-8859-1?q?9SA+Aa3n9dA3kZ+CfJ/zr37X2wVd0du6b55CdNr51tWjYOxzxf1vYR9WYMo4?= =?iso-8859-1?q?HmqKB3cNrkc4AJ9NeBluGqLfxRVL1SHZhP1ZKKd9jYbjSgQvJYCoJUZVZmKM?= =?iso-8859-1?q?1ShEICndbvoDt0YZ9KV/5TACd/TBjHdg36dG+L6G88eKQXJQKVLHARHxF/qO?= =?iso-8859-1?q?KSH06gdWXT3gDLiaJvnPZRW+6iKXkVqQzIVfoN1KuG3zERetzrm+bT4byAzX?= =?iso-8859-1?q?yu4oDYB2II4goguwTN7v9vEvfnFaPzMjLGqQcMrxfbE6qlaY922KdX5NJi15?= =?iso-8859-1?q?D7wZM6rBD9r5OuWClG90mxLtiMv96dDNYo4HVjt7zgrA1jmOuzfZygWegamY?= =?iso-8859-1?q?sZWuo4yRFEoYcYjRbjohRYvuNZFMqlHB2JB3hNYid8Sd7a3qk2KDIfyHjnAH?= =?iso-8859-1?q?2t+fYiF642s9FFJINhwkqMIG4EzMGUEINA90WJMZD7CnnZoFzXCcoAVWPjrX?= =?iso-8859-1?q?+ZVIB563YWP8wB1EAQ7syYVmYMtHe1XJeVcD6bEJZt605JLrNVS5wPfPXesP?= =?iso-8859-1?q?P573zHLG/+3NMI6sgfTrdcfbKTREwzXJU8TYBaGOJDxNPyjXT2tEDZVMraKa?= =?iso-8859-1?q?npdhESVXFQXFiK1ZlskucCZFGJdZWPBuZ5bCf/uJFIImEAJZ5RKqK3pI8Eij?= =?iso-8859-1?q?ONmTMBV/fN/KdsLBfhJqPW0X3lP2F6IL0rZT/7sq6sQ4NSZHGtGpcuVRm99K?= =?iso-8859-1?q?MF4Mk9mUoSitpTK765BNBQf78ak1O2oAyFTc2ePaKAyHNDKLNFnYprN6BJHE?= =?iso-8859-1?q?JoMT3Z/7XO0b5OLM0hncjoYC8tDDUIhHYi/XYODwTA6X+9i/fdFf1CI1XO3c?= =?iso-8859-1?q?GHRc28i/G2Mv4DkExA4SMiLWohSuGofJnq+aA/C5T3Fl8GyDcs8u4p4QgpZG?= =?iso-8859-1?q?J9rTwHeAutDvopE2p?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: geqbiHo8sPQ1hXfiIesqBzVMZagu75olY+T7jcSXZD+RWD6JLCPi4JAAhdgSGYOPszHcY+Bhu4TmaDRc2LpLNrE15M9qu/0iuw8CeQTUM/acdNgDH5XAFUnAw8HPCVuj2hF0NpFVsCKgfnIs2FRQpSgYta1iudP6hahcOscOFdpNelMlQi4a10SBJk0RpyMCjthaWr/1mlVgnDTOb3qP5xg48Oy+tcIugljG0KelteYTu2Vp2OTuLVlytm3ME4lwIipelQr1Mlgy5O1BdI4d5OGaZuv7dkmJPoODRMM5armVt1yqkgDsYa1bj+w4ZEBtH5Xok7s6m256z4dvzmxXwyPNWQ8cNtcsi7Ad4uu1YKbZdT7JuON9e4KSCbrp30p+geZ3pKxl38DstxpdPgc/Ls2mZScy8s1gv16QKftdBF+R7WbTVb0AHtwMzaHqkL6QLBtj0IQtDLf0HVrER8qeaoJWjTLJF//LhWasFpLNzYCeEydfpmKUogWAxAsKclewkL7HXxwlUHMfxnQ88XUqTlzuie6yyQbFLwdLk6bZHRsjWZzsslUtmIdyxCojemEmQUquPDRYR1+R4o/KA805f3CFoQZ09in2ZzA/y0lXVd9aw6qECyyfYC0Q3tWzrtTRJN7QreVSaL5bmR8VHwgqsQ== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f938bc2a-4e4c-43b2-638f-08dd04480402 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2024 01:02:30.7617 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: g+hy79fYI5M3oDBm3QNRuUr3RvKapZKlolWnZgvALCZDakETMv+ahc4G3g3Etrw5T57JAR255z7Qh1JkLgLp1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7950 X-Authority-Analysis: v=2.4 cv=UvMxNPwB c=1 sm=1 tr=0 ts=67354c2c cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10 a=VlfZXiiP6vEA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=M3LnWOeIi3LTSXqGCcYA:9 a=wPNLvfGTeEIA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-GUID: d2l7RpX7w9rvpxJQGZVyQ7e-ECeWzMFq X-Proofpoint-ORIG-GUID: d2l7RpX7w9rvpxJQGZVyQ7e-ECeWzMFq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 adultscore=0 clxscore=1015 impostorscore=0 suspectscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411140005 Now that we track TRBs base on request->num_trbs on reclaim, we don't need to save the dwc3_request->needs_extra_trb check. Remove it. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h | 3 --- drivers/usb/dwc3/gadget.c | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index aa09ccbf34a5..ee73789326bc 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -949,8 +949,6 @@ struct dwc3_hwparams { * @trb: pointer to struct dwc3_trb * @trb_dma: DMA address of @trb * @num_trbs: number of TRBs used by this request - * @needs_extra_trb: true when request needs one extra TRB (either due to ZLP - * or unaligned OUT) * @direction: IN or OUT direction flag * @mapped: true when request has been dma-mapped */ @@ -979,7 +977,6 @@ struct dwc3_request { unsigned int num_trbs; - unsigned int needs_extra_trb:1; unsigned int direction:1; unsigned int mapped:1; }; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 687bb8cc4114..83dc7304d701 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -197,7 +197,6 @@ static void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep, list_del(&req->list); req->remaining = 0; - req->needs_extra_trb = false; req->num_trbs = 0; if (req->request.status == -EINPROGRESS) @@ -1440,6 +1439,7 @@ static int dwc3_prepare_last_sg(struct dwc3_ep *dep, unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); unsigned int rem = req->request.length % maxp; unsigned int num_trbs = 1; + bool needs_extra_trb; if (dwc3_needs_extra_trb(dep, req)) num_trbs++; @@ -1447,15 +1447,15 @@ static int dwc3_prepare_last_sg(struct dwc3_ep *dep, if (dwc3_calc_trbs_left(dep) < num_trbs) return 0; - req->needs_extra_trb = num_trbs > 1; + needs_extra_trb = num_trbs > 1; /* Prepare a normal TRB */ if (req->direction || req->request.length) dwc3_prepare_one_trb(dep, req, entry_length, - req->needs_extra_trb, node, false, false); + needs_extra_trb, node, false, false); /* Prepare extra TRBs for ZLP and MPS OUT transfer alignment */ - if ((!req->direction && !req->request.length) || req->needs_extra_trb) + if ((!req->direction && !req->request.length) || needs_extra_trb) dwc3_prepare_one_trb(dep, req, req->direction ? 0 : maxp - rem, false, 1, true, false);