]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: fix -Wtype-limits compilation warnings
authorQian Cai <cai@lca.pw>
Mon, 22 Jul 2019 18:34:42 +0000 (14:34 -0400)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 29 Jul 2019 21:20:19 +0000 (14:20 -0700)
commit903fa0c860659f01fab00fe4b75f1a177296a63a
tree9dfb7d4efee1a3a05d96e479e8365302d4a666d3
parent3946fc9291da929ed6836ab79a3b87c34d142954
net/mlx5: fix -Wtype-limits compilation warnings

The commit 1d34e1f9ff46 ("net/mlx5: Use event mask based on device
capabilities") introduced a few compilation warnings due to it bumps
MLX5_EVENT_TYPE_MAX from 0x27 to 0x100 which is always greater than
an "struct {mlx5_eqe|mlx5_nb}.type" that is an "u8".

drivers/net/ethernet/mellanox/mlx5/core/eq.c: In function
'mlx5_eq_notifier_register':
drivers/net/ethernet/mellanox/mlx5/core/eq.c:948:21: warning: comparison
is always false due to limited range of data type [-Wtype-limits]
  if (nb->event_type >= MLX5_EVENT_TYPE_MAX)
                     ^~
drivers/net/ethernet/mellanox/mlx5/core/eq.c: In function
'mlx5_eq_notifier_unregister':
drivers/net/ethernet/mellanox/mlx5/core/eq.c:959:21: warning: comparison
is always false due to limited range of data type [-Wtype-limits]
  if (nb->event_type >= MLX5_EVENT_TYPE_MAX)

Fix them by removing unnecessary checkings.

Fixes: 1d34e1f9ff46 ("net/mlx5: Use event mask based on device capabilities")
Signed-off-by: Qian Cai <cai@lca.pw>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eq.c