RDMA/mlx5: Fix error propagation in __mlx5_ib_add
Subsystems (2)
PATCH 1/1 RDMA/mlx5: Fix error propagation in __mlx5_ib_add
From: Li RongQing <[email protected]>
__mlx5_ib_add() currently returns -ENOMEM on any stage initialization failure, losing the actual error code returned by the init function. This makes it impossible for callers to distinguish between different failure reasons (e.g. -EINVAL, -EIO, -EOPNOTSUPP) and leads to misleading error handling.
Fix it by returning the actual error code stored in 'err'.
--- drivers/infiniband/hw/mlx5/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -5112,7 +5112,7 @@ int __mlx5_ib_add(struct mlx5_ib_dev *dev,if (profile->stage[i].cleanup) profile->stage[i].cleanup (dev); } -return -ENOMEM ; +return err; }static const struct mlx5_ib_profile pf_profile = {
Signature · 1 line
2.9.4
Quoted 8 lines · lirongqing
From: Li RongQing <[email protected]>
__mlx5_ib_add()currently returns-ENOMEMon any stage initialization failure, losing the actual error code returned by the init function. This makes it impossible for callers to distinguish between different failure reasons (e.g.-EINVAL,-EIO,-EOPNOTSUPP) and leads to misleading error handling.
Quoted 6 lines
Fix it by returning the actual error code stored in 'err'.
Signed-off-by Li RongQing <[email protected]>--- drivers/infiniband/hw/mlx5/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next, thanks
Jason