Skip to contentSkip to conversation

RDMA/mlx5: Fix error propagation in __mlx5_ib_add

PATCH Applied lirongqing 2 participants 2 messages Jun 1 – Jun 5

Subsystems (2)
lore
Share & tools
lore

lirongqing

author
#0 lore raw

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
index 6107828..c7ae46e 100644
@@ -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
maintainer Applied
#1 lore raw
Quoted 8 lines · lirongqing

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.

Quoted 6 lines

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(-)

Applied to for-next, thanks

Jason