Commit 630d4e75 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller
Browse files

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: 4a7f970f ("mlxsw: spectrum: Replace port_to_module array with array of structs")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69625ea7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -4079,9 +4079,11 @@ 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;

err_port_module_info_get: