Skip to contentSkip to conversation

RDMA/mlx5: Return proper error value

PATCH Applied Leon Romanovsky 2 participants 2 messages Oct 29, 2019 – Oct 31, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx5: Return proper error value

From: Leon Romanovsky <[email protected]>

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")
---
 drivers/infiniband/hw/mlx5/mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mr.c +1 -1
index 7019c12005f4..99d563dba91b 100644
@@ -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];
Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

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")
---
 drivers/infiniband/hw/mlx5/mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason