mlxsw: spectrum: Fix error return code in mlxsw_sp_port_module_info_init()
PATCH 1/1 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 <[email protected]>
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +3 -1
@@ -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 ;
Quoted 5 lines · Wed, Nov 06, 2019 at 03:52:31PM CET, [email protected] wrote:
Fix to return negative error code
-ENOMEMfrom 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 <[email protected]>
Reviewed-by Jiri Pirko <[email protected]>
From: Wei Yongjun <[email protected]>
Date: Wed, 6 Nov 2019 14:52:31 +0000
Quoted 5 lines
Fix to return negative error code
-ENOMEMfrom 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 <[email protected]>
Applied, thank you.