]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
net/mlx5: Fix static checker warnings
authorOr Gerlitz <ogerlitz@mellanox.com>
Thu, 8 Dec 2016 10:58:45 +0000 (12:58 +0200)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 1 Mar 2017 13:55:56 +0000 (06:55 -0700)
BugLink: http://bugs.launchpad.net/bugs/1668019
For some reason, sparse doesn't like using an expression of type (!x)
with a bitwise | and &.  In order to mitigate that, we use a local variable.

This removes the following sparse complaints on the core driver
(and similar ones on the IB driver too):

drivers/net/ethernet/mellanox/mlx5/core/srq.c:83:9: warning: dubious: !x & y
drivers/net/ethernet/mellanox/mlx5/core/srq.c:96:9: warning: dubious: !x & y
drivers/net/ethernet/mellanox/mlx5/core/port.c:59:9: warning: dubious: !x & y
drivers/net/ethernet/mellanox/mlx5/core/vport.c:561:9: warning: dubious: !x & y

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit a61d5ce9cc56e2e41bbb1ad62ca7a16d7e7567bd)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
include/linux/mlx5/device.h

index 52b437431c6a642b04d33da532cfcd722c69fa0f..ea4fb0a883f416fee12a3a82f81e8e57262902df 100644 (file)
 
 /* insert a value to a struct */
 #define MLX5_SET(typ, p, fld, v) do { \
+       u32 _v = v; \
        BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32);             \
        *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
        cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
-                    (~__mlx5_dw_mask(typ, fld))) | (((v) & __mlx5_mask(typ, fld)) \
+                    (~__mlx5_dw_mask(typ, fld))) | (((_v) & __mlx5_mask(typ, fld)) \
                     << __mlx5_dw_bit_off(typ, fld))); \
 } while (0)