From: Li RongQing Date: Mon, 1 Jun 2026 09:56:54 +0000 (-0400) Subject: RDMA/mlx5: Fix error propagation in __mlx5_ib_add X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309cacf953aa7e289ce50b3e7e4424c63103c333;p=thirdparty%2Flinux.git RDMA/mlx5: Fix error propagation in __mlx5_ib_add __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'. Link: https://patch.msgid.link/r/20260601095654.2178-1-lirongqing@baidu.com Signed-off-by: Li RongQing Signed-off-by: Jason Gunthorpe --- diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 12bfefc91b023..e2e8feb1b60d1 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -5116,7 +5116,7 @@ err_out: if (profile->stage[i].cleanup) profile->stage[i].cleanup(dev); } - return -ENOMEM; + return err; } static const struct mlx5_ib_profile pf_profile = {