[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ca8b04cf5ef4e0099a04637df8293ac@AcuMS.aculab.com>
Date: Fri, 21 Oct 2022 22:02:35 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Linus Torvalds' <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Felipe Balbi <balbi@...nel.org>,
Jakob Koschel <jakobkoschel@...il.com>,
Randy Dunlap <rdunlap@...radead.org>,
Ira Weiny <ira.weiny@...el.com>
Subject: RE: [PATCH] USB: gadget: dummy_hcd: switch char * to u8 *
From: Linus Torvalds
> Sent: 21 October 2022 18:31
...
> I think you might as well also remove the cast that was always a bit odd:
>
> buf[0] = (u8)dum->devstatus;
...
> I suspect a comment would be more readable than an odd cast that
> doesn't actually change anything (since the assignment does it
> anyway).
I've seen a compiler generate an '& 0xff' for the cast before
storing the low byte.
Don't even think about what that compiler would generated for:
buf[0] = (u8)(dum->devstatus & 0xff);
The code is much easier to read as just an assignment :-)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists