IB/mlx5: Fix a NULL vs IS_ERR() check
Subsystems (3)
PATCH 1/1 IB/mlx5: Fix a NULL vs IS_ERR() check
The kzalloc() function returns NULL, not error pointers.
Fixes 30f2fe40c72b ("IB/mlx5: Introduce UAPIs to manage packet pacing")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/infiniband/hw/mlx5/qos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/qos.c +2 -2
@@ -46,8 +46,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_PP_OBJ_ALLOC)( dev =to_mdev (c->ibucontext.device); pp_entry =kzalloc (sizeof (*pp_entry),GFP_KERNEL ); -if (IS_ERR (pp_entry)) -return PTR_ERR (pp_entry); +if (!pp_entry) +return -ENOMEM ; in_ctx =uverbs_attr_get_alloced_ptr (attrs,MLX5_IB_ATTR_PP_OBJ_ALLOC_CTX );
Signature · 1 line
2.25.1
Quoted 8 lines · Dan Carpenter
The
kzalloc()function returns NULL, not error pointers.Fixes 30f2fe40c72b ("IB/mlx5: Introduce UAPIs to manage packet pacing")Signed-off-by Dan Carpenter <[email protected]>--- drivers/infiniband/hw/mlx5/qos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Of course, thanks a lot.
Acked-by Leon Romanovsky <[email protected]>
Jason Gunthorpe
AppliedQuoted 8 lines · Dan Carpenter
The
kzalloc()function returns NULL, not error pointers.Fixes 30f2fe40c72b ("IB/mlx5: Introduce UAPIs to manage packet pacing")Signed-off-by Dan Carpenter <[email protected]>Acked-by Leon Romanovsky <[email protected]>--- drivers/infiniband/hw/mlx5/qos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied to for-next, thanks
Jason