]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
thunderbolt: Make priority unsigned in struct tb_path
authorNathan Chancellor <natechancellor@gmail.com>
Wed, 24 Apr 2019 18:34:13 +0000 (11:34 -0700)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 25 Apr 2019 09:18:27 +0000 (12:18 +0300)
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;

Furthermore, that value is only assigned to an unsigned integer in
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>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb.h

index 15d225dcb40320b10fa08e5460dd892d0bd1f8d3..b12c8f33d89c682ef6dad76edda6ee2e87262391 100644 (file)
@@ -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;