Re: [PATCH] thunderbolt: Make priority unsigned in struct tb_path

From: Mika Westerberg
Date: Thu Apr 25 2019 - 05:24:14 EST


On Wed, Apr 24, 2019 at 12:00:05PM -0700, Nathan Chancellor wrote:
> On Wed, Apr 24, 2019 at 11:49:37AM -0700, Nick Desaulniers wrote:
> > On Wed, Apr 24, 2019 at 11:34 AM Nathan Chancellor
> > <natechancellor@xxxxxxxxx> wrote:
> > >
> > > Clang warns:
> > >
> > > drivers/thunderbolt/tunnel.c:504:17: warning: implicit truncation from
> > > 'int' to bit-field changes value from 5 to -3
> > > [-Wbitfield-constant-conversion]
> > > path->priority = 5;
> > > ^ ~
> > > 1 warning generated.
> > >
> > > The priority member in struct tb_path is only ever assigned a positive
> > > number:
> > >
> > > $ rg -n priority drivers/thunderbolt/path.c
> > > drivers/thunderbolt/tunnel.c:99: path->priority = 3;
> > > drivers/thunderbolt/tunnel.c:308: path->priority = 2;
> > > drivers/thunderbolt/tunnel.c:323: path->priority = 1;
> > > drivers/thunderbolt/tunnel.c:504: path->priority = 5;
> >
> > LGTM. Looks like drivers/thunderbolt/tb_regs.h also defines it as u32
> > (no change needed here).
> > Triple checking it's uses, looks like it gets assigned:
> > drivers/thunderbolt/path.c#L492:
> > hop.priority = path->priority;
> > hop is an instance of a struct tb_regs_hop, which is the definition I
> > was looking at above. LGTM thanks Nathan!
> > Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
>
> Thanks for the review!
>
> >
> > >
> > > Furthmore, that value is only assigned to an unsigned integer in
>
> Although apparently I can't spell... should be "Furthermore".

Fixed the typo and applied to thunderbolt.git/next, thanks!