diff mbox

RDMA/bnxt_re: Fix an error code in bnxt_qplib_create_srq()

Message ID 20180130150434.GA13690@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Jan. 30, 2018, 8:40 p.m. UTC
We should return -ENOMEM if the allocation fails.  (The current code
returns succees).

Fixes: 37cb11acf1f7 ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Devesh Sharma Jan. 31, 2018, 5:36 a.m. UTC | #1
On Wed, Jan 31, 2018 at 2:10 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We should return -ENOMEM if the allocation fails.  (The current code
> returns succees).
>
> Fixes: 37cb11acf1f7 ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> index 8b5f11ac0e42..1b0e94697fe3 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> @@ -557,8 +557,10 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
>
>         srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq),
>                            GFP_KERNEL);
> -       if (!srq->swq)
> +       if (!srq->swq) {
> +               rc = -ENOMEM;
>                 goto fail;
> +       }

Opps!! my bad. Thanks for fixing.

Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>

>
>         RCFW_CMD_PREP(req, CREATE_SRQ, cmd_flags);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Jan. 31, 2018, 4:19 p.m. UTC | #2
On Wed, 2018-01-31 at 11:06 +0530, Devesh Sharma wrote:
> On Wed, Jan 31, 2018 at 2:10 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > We should return -ENOMEM if the allocation fails.  (The current code
> > returns succees).
> > 
> > Fixes: 37cb11acf1f7 ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> > index 8b5f11ac0e42..1b0e94697fe3 100644
> > --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> > +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> > @@ -557,8 +557,10 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
> > 
> >         srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq),
> >                            GFP_KERNEL);
> > -       if (!srq->swq)
> > +       if (!srq->swq) {
> > +               rc = -ENOMEM;
> >                 goto fail;
> > +       }
> 
> Opps!! my bad. Thanks for fixing.
> 
> Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>

Thanks, applied.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index 8b5f11ac0e42..1b0e94697fe3 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -557,8 +557,10 @@  int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
 
 	srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq),
 			   GFP_KERNEL);
-	if (!srq->swq)
+	if (!srq->swq) {
+		rc = -ENOMEM;
 		goto fail;
+	}
 
 	RCFW_CMD_PREP(req, CREATE_SRQ, cmd_flags);