From: Jack Morgenstein Date: Thu, 24 Jan 2013 01:54:17 +0000 (+0000) Subject: net/mlx4_core: Return proper error code when __mlx4_add_one fails X-Git-Tag: firefly_0821_release~3680^2~1092^2~251 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f356fcbe12c1174713e83651b630330f8f0f8415;p=firefly-linux-kernel-4.4.55.git net/mlx4_core: Return proper error code when __mlx4_add_one fails Returning 0 (success) when in fact we are aborting the load, leads to kernel panic when unloading the module. Fix that by returning the actual error code. Signed-off-by: Jack Morgenstein Signed-off-by: Eugenia Emantayev Signed-off-by: Amir Vadai Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index e1bafffbc3b1..983fd3d62bce 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -2169,7 +2169,8 @@ slave_start: dev->num_slaves = MLX4_MAX_NUM_SLAVES; else { dev->num_slaves = 0; - if (mlx4_multi_func_init(dev)) { + err = mlx4_multi_func_init(dev); + if (err) { mlx4_err(dev, "Failed to init slave mfunc" " interface, aborting.\n"); goto err_cmd; @@ -2193,7 +2194,8 @@ slave_start: /* In master functions, the communication channel must be initialized * after obtaining its address from fw */ if (mlx4_is_master(dev)) { - if (mlx4_multi_func_init(dev)) { + err = mlx4_multi_func_init(dev); + if (err) { mlx4_err(dev, "Failed to init master mfunc" "interface, aborting.\n"); goto err_close; @@ -2210,6 +2212,7 @@ slave_start: mlx4_enable_msi_x(dev); if ((mlx4_is_mfunc(dev)) && !(dev->flags & MLX4_FLAG_MSI_X)) { + err = -ENOSYS; mlx4_err(dev, "INTx is not supported in multi-function mode." " aborting.\n"); goto err_free_eq;