]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RDMA/mlx5: Fix error propagation in __mlx5_ib_add
authorLi RongQing <lirongqing@baidu.com>
Mon, 1 Jun 2026 09:56:54 +0000 (05:56 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 5 Jun 2026 16:41:48 +0000 (13:41 -0300)
__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 <lirongqing@baidu.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/main.c

index 12bfefc91b023c640cfb569da2be820322536498..e2e8feb1b60d139d5fe18d41f3e7785fe76e5f23 100644 (file)
@@ -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 = {