diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2019-11-06 17:52:31 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-08 02:12:55 +0300 |
commit | 630d4e75dd2969bf7da40beb3d4704356d12ae39 (patch) | |
tree | 921c3e688995bc1ac5c65ff7c9a264188cbaf589 /drivers/net/ethernet/mellanox | |
parent | 69625ea7bdfc928a9251435123bcf642462ef6c6 (diff) | |
download | linux-630d4e75dd2969bf7da40beb3d4704356d12ae39.tar.xz |
mlxsw: spectrum: Fix error return code in mlxsw_sp_port_module_info_init()
Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.
Fixes: 4a7f970f1240 ("mlxsw: spectrum: Replace port_to_module array with array of structs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index ea4cc2aa99e0..838c014f6ed1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -4079,8 +4079,10 @@ static int mlxsw_sp_port_module_info_init(struct mlxsw_sp *mlxsw_sp) mlxsw_sp->port_mapping[i] = kmemdup(&port_mapping, sizeof(port_mapping), GFP_KERNEL); - if (!mlxsw_sp->port_mapping[i]) + if (!mlxsw_sp->port_mapping[i]) { + err = -ENOMEM; goto err_port_module_info_dup; + } } return 0; |