Skip to content
Commit ed2da627 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller
Browse files

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: 887839e6 ("mlxsw: spectrum_kvdl: Add support for dynamic partition set")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarArkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b89c7695
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment