diff mbox series

RDMA/bnxt_re: Fix an IS_ERR() vs NULL check

Message ID 8d92e85f-626b-4eca-8501-ca7024cfc0ee@moroto.mountain (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/bnxt_re: Fix an IS_ERR() vs NULL check | expand

Commit Message

Dan Carpenter June 27, 2023, 7:20 a.m. UTC
The bnxt_re_mmap_entry_insert() function returns NULL, not error pointers.
Update the check for errors accordingly.

Fixes: 360da60d6c6e ("RDMA/bnxt_re: Enable low latency push")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Selvin Xavier June 27, 2023, 8:31 a.m. UTC | #1
On Tue, Jun 27, 2023 at 12:50 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The bnxt_re_mmap_entry_insert() function returns NULL, not error pointers.
> Update the check for errors accordingly.
>
> Fixes: 360da60d6c6e ("RDMA/bnxt_re: Enable low latency push")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index df757da95ac2..abef0b8baa7c 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -4213,8 +4213,8 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_ALLOC_PAGE)(struct uverbs_attr_bundle *
>         }
>
>         entry = bnxt_re_mmap_entry_insert(uctx, dbr, mmap_flag, &mmap_offset);
> -       if (IS_ERR(entry))
> -               return PTR_ERR(entry);
> +       if (!entry)
> +               return -ENOMEM;
>
>         uobj->object = entry;
>         uverbs_finalize_uobj_create(attrs, BNXT_RE_ALLOC_PAGE_HANDLE);
> --
> 2.39.2
>
Jason Gunthorpe June 27, 2023, 5:03 p.m. UTC | #2
On Tue, Jun 27, 2023 at 10:20:13AM +0300, Dan Carpenter wrote:
> The bnxt_re_mmap_entry_insert() function returns NULL, not error pointers.
> Update the check for errors accordingly.
> 
> Fixes: 360da60d6c6e ("RDMA/bnxt_re: Enable low latency push")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> Acked-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index df757da95ac2..abef0b8baa7c 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -4213,8 +4213,8 @@  static int UVERBS_HANDLER(BNXT_RE_METHOD_ALLOC_PAGE)(struct uverbs_attr_bundle *
 	}
 
 	entry = bnxt_re_mmap_entry_insert(uctx, dbr, mmap_flag, &mmap_offset);
-	if (IS_ERR(entry))
-		return PTR_ERR(entry);
+	if (!entry)
+		return -ENOMEM;
 
 	uobj->object = entry;
 	uverbs_finalize_uobj_create(attrs, BNXT_RE_ALLOC_PAGE_HANDLE);