Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A32D1131 for ; Fri, 1 Dec 2023 09:32:09 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-52-E9OJgobLNGGGloQH9QNw4Q-1; Fri, 01 Dec 2023 17:32:00 +0000 X-MC-Unique: E9OJgobLNGGGloQH9QNw4Q-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 1 Dec 2023 17:31:53 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Fri, 1 Dec 2023 17:31:52 +0000 From: David Laight To: 'Mathias Nyman' , "gregkh@linuxfoundation.org" CC: "linux-usb@vger.kernel.org" , Andy Shevchenko Subject: RE: [PATCH 08/19] xhci: dbc: Use sizeof_field() where it makes sense Thread-Topic: [PATCH 08/19] xhci: dbc: Use sizeof_field() where it makes sense Thread-Index: AQHaJGfznirkAH2q70aZpnygD+weDLCUrt6w Date: Fri, 1 Dec 2023 17:31:52 +0000 Message-ID: References: <20231201150647.1307406-1-mathias.nyman@linux.intel.com> <20231201150647.1307406-9-mathias.nyman@linux.intel.com> In-Reply-To: <20231201150647.1307406-9-mathias.nyman@linux.intel.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Mathias Nyman > Sent: 01 December 2023 15:07 >=20 > From: Andy Shevchenko >=20 > Instead of doing custom calculations, use sizeof_field() macro. >=20 > Signed-off-by: Andy Shevchenko > Signed-off-by: Mathias Nyman > --- > drivers/usb/host/xhci-dbgcap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgca= p.c > index 779a564ad698..0c9fd61e9c5b 100644 > --- a/drivers/usb/host/xhci-dbgcap.c > +++ b/drivers/usb/host/xhci-dbgcap.c > @@ -374,7 +374,7 @@ static void xhci_dbc_eps_init(struct xhci_dbc *dbc) >=20 > static void xhci_dbc_eps_exit(struct xhci_dbc *dbc) > { > -=09memset(dbc->eps, 0, sizeof(struct dbc_ep) * ARRAY_SIZE(dbc->eps)); > +=09memset(dbc->eps, 0, sizeof_field(struct xhci_dbc, eps)); Isn't that just: =09memset(dpc->eps, 0, sizeof (dpc->eps)); perhaps better written as: =09memset(&dpc->epc, 0, sizeof (dpc->eps); Otherwise the existing code wouldn't make sense at all. =09David > } >=20 > static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring= , > -- > 2.25.1 >=20 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)