All of
 help / color / mirror / Atom feed
From: Leon Romanovsky <>
To: Doug Ledford <>, Jason Gunthorpe <>
Cc: Leon Romanovsky <>,
	RDMA mailing list <>,
	Artemy Kovalyov <>
Subject: [PATCH rdma-rc] RDMA/mlx5: Return proper error value
Date: Tue, 29 Oct 2019 07:57:21 +0200	[thread overview]
Message-ID: <> (raw)

From: Leon Romanovsky <>

Returned value from mlx5_mr_cache_alloc() is checked to be error
or real pointer. Return proper error code instead of NULL which
is not checked later.

Fixes: 81713d3788d2 ("IB/mlx5: Add implicit MR support")
Signed-off-by: Leon Romanovsky <>
 drivers/infiniband/hw/mlx5/mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 7019c12005f4..99d563dba91b 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -428,7 +428,7 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, int entry)
 	if (entry < 0 || entry >= MAX_MR_CACHE_ENTRIES) {
 		mlx5_ib_err(dev, "cache entry %d is out of range\n", entry);
-		return NULL;
+		return ERR_PTR(-EINVAL);
 	ent = &cache->ent[entry];

             reply	other threads:[~2019-10-29  5:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  5:57 Leon Romanovsky [this message]
2019-10-31 18:37 ` [PATCH rdma-rc] RDMA/mlx5: Return proper error value Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.