linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] IB/mlx5: Add missing error code
@ 2021-02-22  8:25 YueHaibing
  2021-02-22 12:12 ` kernel test robot
  2021-02-22 12:23 ` [PATCH v2 " YueHaibing
  0 siblings, 2 replies; 6+ messages in thread
From: YueHaibing @ 2021-02-22  8:25 UTC (permalink / raw)
  To: leon, dledford, jgg, yishaih; +Cc: linux-rdma, linux-kernel, YueHaibing

Set err to -ENOMEM if kzalloc fails instead of 0.

Fixes: 759738537142 ("IB/mlx5: Enable subscription for device events over DEVX")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/infiniband/hw/mlx5/devx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index ebc2a4355fa5..3c8e6a25465d 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -2073,8 +2073,10 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT)(
 
 		num_alloc_xa_entries++;
 		event_sub = kzalloc(sizeof(*event_sub), GFP_KERNEL);
-		if (!event_sub)
+		if (!event_sub) {
+			err = -ENOMEM
 			goto err;
+		}
 
 		list_add_tail(&event_sub->event_list, &sub_list);
 		uverbs_uobject_get(&ev_file->uobj);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-02  1:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22  8:25 [PATCH -next] IB/mlx5: Add missing error code YueHaibing
2021-02-22 12:12 ` kernel test robot
2021-02-22 12:23 ` [PATCH v2 " YueHaibing
2021-02-22 13:23   ` Leon Romanovsky
2021-02-22 14:21     ` YueHaibing
2021-03-01 18:49   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).