From: Nathan Chancellor <natechancellor@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
clang-built-linux@googlegroups.com
Subject: Re: [PATCH] thunderbolt: Make priority unsigned in struct tb_path
Date: Wed, 24 Apr 2019 12:00:05 -0700 [thread overview]
Message-ID: <20190424190005.GA9406@archlinux-i9> (raw)
In-Reply-To: <CAKwvOdkHiBhFsgEvLrr6oD84GKetDFV2b=n1DYDewCUyHWf7oA@mail.gmail.com>
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@gmail.com> 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@google.com>
Thanks for the review!
>
> >
> > Furthmore, that value is only assigned to an unsigned integer in
Although apparently I can't spell... should be "Furthermore".
> > tb_path_activate (the priority member in struct tb_regs_hop).
> >
> > Fixes: 44242d6c9703 ("thunderbolt: Add support for DMA tunnels")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/454
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/thunderbolt/tb.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
> > index 15d225dcb403..b12c8f33d89c 100644
> > --- a/drivers/thunderbolt/tb.h
> > +++ b/drivers/thunderbolt/tb.h
> > @@ -225,7 +225,7 @@ struct tb_path {
> > enum tb_path_port ingress_fc_enable;
> > enum tb_path_port egress_fc_enable;
> >
> > - int priority:3;
> > + unsigned int priority:3;
> > int weight:4;
> > bool drop_packages;
> > bool activated;
> > --
> > 2.21.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
next prev parent reply other threads:[~2019-04-24 19:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 18:34 Nathan Chancellor
2019-04-24 18:49 ` Nick Desaulniers
2019-04-24 19:00 ` Nathan Chancellor [this message]
2019-04-24 19:02 ` Nick Desaulniers
2019-04-25 9:22 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190424190005.GA9406@archlinux-i9 \
--to=natechancellor@gmail.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®