From: Dan Carpenter Date: Fri, 20 Mar 2020 13:26:41 +0000 (+0300) Subject: IB/mlx5: Fix a NULL vs IS_ERR() check X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a766fa84738f52f8227eb96aed4362725a82ccf2;p=linux.git 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") Link: https://lore.kernel.org/r/20200320132641.GF95012@mwanda Signed-off-by: Dan Carpenter Acked-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe --- diff --git a/drivers/infiniband/hw/mlx5/qos.c b/drivers/infiniband/hw/mlx5/qos.c index f822b06e7c9ec..cac878a70edb0 100644 --- a/drivers/infiniband/hw/mlx5/qos.c +++ b/drivers/infiniband/hw/mlx5/qos.c @@ -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);