]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: core: mlxsw: core: avoid -Wint-in-bool-context warning
authorArnd Bergmann <arnd@arndb.de>
Mon, 18 Mar 2019 16:35:11 +0000 (17:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Mar 2019 20:26:03 +0000 (13:26 -0700)
commita44613753c8f3065436d6cb5e0a5cfa7db0846f8
tree572d1258bb8c9eabfbe43ef99d6c5483e7bc6659
parent275f6ddc5e0333a4e522ad969d9b195f917af4c0
mlxsw: core: mlxsw: core: avoid -Wint-in-bool-context warning

A recently added function in mlxsw triggers a harmless compiler warning:

In file included from drivers/net/ethernet/mellanox/mlxsw/core.h:17,
                 from drivers/net/ethernet/mellanox/mlxsw/core_env.c:7:
drivers/net/ethernet/mellanox/mlxsw/core_env.c: In function 'mlxsw_env_module_temp_thresholds_get':
drivers/net/ethernet/mellanox/mlxsw/reg.h:8015:45: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
 #define MLXSW_REG_MTMP_TEMP_TO_MC(val) (val * 125)
                                        ~~~~~^~~~~~
drivers/net/ethernet/mellanox/mlxsw/core_env.c:116:8: note: in expansion of macro 'MLXSW_REG_MTMP_TEMP_TO_MC'
   if (!MLXSW_REG_MTMP_TEMP_TO_MC(module_temp)) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~

The warning is normally disabled, but it would be nice to enable
it to find real bugs, and there are no other known instances at
the moment.

Replace the negation with a zero-comparison, which also matches
the comment above it.

Fixes: 91f98fa2ca9c ("mlxsw: core: Add API for QSFP module temperature thresholds reading")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_env.c