mlxsw: spectrum_kvdl: avoid uninitialized variable warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 23 Feb 2018 13:15:32 +0000 (14:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Feb 2018 16:33:02 +0000 (11:33 -0500)
commited2da6270ed9ea37d39e9ab597fc5b3b4215ae2a
treee94c9ff12e64271f1ddd10feca2ba2f505780b12
parentb89c7695b14f58686ac89d5add861f1f6d3fd4da
mlxsw: spectrum_kvdl: avoid uninitialized variable warning

gcc warns that 'resource_id' is not initialized if we don't come though
any of the three 'case' statements before:

drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c: In function 'mlxsw_sp_kvdl_part_init':
drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c:275:8: error: 'resource_id' may be used uninitialized in this function [-Werror=maybe-uninitialized]

In the current code, that won't happen, but it's more robust to explicitly
handle this by returning a failure from mlxsw_sp_kvdl_part_init.

Fixes: 887839e6960d ("mlxsw: spectrum_kvdl: Add support for dynamic partition set")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c