Skip to contentSkip to conversation

vdpa/mlx5: Missing error code on allocation failure

PATCH New Dan Carpenter 1 participant 1 message Aug 8, 2020

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

PATCH 1/1 vdpa/mlx5: Missing error code on allocation failure

This should return -ENOMEM if the allocation fails. Currently it either returns success or an uninitialized value.

Fixes 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
---
 drivers/vdpa/mlx5/core/mr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/core/mr.c +3 -1
index f5dec0274133..ef1c550f8266 100644
@@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
 	while (size) {
 		sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
 		dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
-		if (!dmr)
+		if (!dmr) {
+			err = -ENOMEM;
 			goto err_alloc;
+		}
 
 		dmr->start = st;
 		dmr->end = st + sz;
Signature · 1 line
2.27.0