Re: [PATCH] usb: cdnsp: Fixes incorrect value in ISOC TRB

From: Greg KH
Date: Sat Mar 06 2021 - 03:20:04 EST


On Sat, Mar 06, 2021 at 08:53:42AM +0800, Peter Chen wrote:
> On 21-03-05 06:10:59, Pawel Laszczak wrote:
> > From: Pawel Laszczak <pawell@xxxxxxxxxxx>
> >
> > The value "start_cycle ? 0 : 1" in assignment caused
> > implicit truncation whole value to 1 byte.
> > To fix the issue, an explicit casting has been added.
>
> The root cause for this issue should be operator "|" priority higher
> than "? :", I think just add () for start_cycle ? 0 : 1 could fix it.
> Please double confirm it, and change the commit log if necessary

Please do not rely on this type of thing to get the code right. Spell
it out with real if () statements so that humans can read it and
understand it and maintain it for the next 10+ years.

thanks,

greg k-h