Skip to content

Commit

Permalink
mlxsw: spectrum: Fix error return code in mlxsw_sp_port_module_info_i…
Browse files Browse the repository at this point in the history
…nit()

Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 4a7f970 ("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>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Nov 7, 2019
1 parent 69625ea commit 630d4e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/mellanox/mlxsw/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 630d4e7

Please sign in to comment.