All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com>,
	Dennis Dalessandro <dennis.dalessandro@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] IB/hfi1: Fix hfi1_netdev_rx_init() error handling
Date: Sun, 31 May 2020 20:36:55 +0300	[thread overview]
Message-ID: <20200531173655.GT22511@kadam> (raw)
In-Reply-To: <20200531100512.GH66309@unreal>

On Sun, May 31, 2020 at 01:05:12PM +0300, Leon Romanovsky wrote:
> On Sat, May 30, 2020 at 05:02:24PM +0300, Dan Carpenter wrote:
> > The hfi1_vnic_up() function doesn't check whether hfi1_netdev_rx_init()
> > returns errors.  In hfi1_vnic_init() we need to change the code to
> > preserve the error code instead of returning success.
> >
> > Fixes: 2280740f01ae ("IB/hfi1: Virtual Network Interface Controller (VNIC) HW support")
> > Fixes: 4730f4a6c6b2 ("IB/hfi1: Activate the dummy netdev")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: Add error handling in hfi1_vnic_up() and add second fixes tag
> >
> >  drivers/infiniband/hw/hfi1/vnic_main.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/hfi1/vnic_main.c b/drivers/infiniband/hw/hfi1/vnic_main.c
> > index b183c56b7b6a4..03f8be8e9488e 100644
> > --- a/drivers/infiniband/hw/hfi1/vnic_main.c
> > +++ b/drivers/infiniband/hw/hfi1/vnic_main.c
> > @@ -457,13 +457,19 @@ static int hfi1_vnic_up(struct hfi1_vnic_vport_info *vinfo)
> >  	if (rc < 0)
> >  		return rc;
> >
> > -	hfi1_netdev_rx_init(dd);
> > +	rc = hfi1_netdev_rx_init(dd);
> > +	if (rc < 0)
> > +		goto err_remove;
> 
> Why did you check for the negative value here and didn't check below?
> 

I just copied the pattern in the nearest code.  I didn't realize until
now that it was different in both functions...  The checking isn't done
consistently in this file.

I can resend on Tuesday though if you want.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com>,
	Dennis Dalessandro <dennis.dalessandro@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] IB/hfi1: Fix hfi1_netdev_rx_init() error handling
Date: Sun, 31 May 2020 17:36:55 +0000	[thread overview]
Message-ID: <20200531173655.GT22511@kadam> (raw)
In-Reply-To: <20200531100512.GH66309@unreal>

On Sun, May 31, 2020 at 01:05:12PM +0300, Leon Romanovsky wrote:
> On Sat, May 30, 2020 at 05:02:24PM +0300, Dan Carpenter wrote:
> > The hfi1_vnic_up() function doesn't check whether hfi1_netdev_rx_init()
> > returns errors.  In hfi1_vnic_init() we need to change the code to
> > preserve the error code instead of returning success.
> >
> > Fixes: 2280740f01ae ("IB/hfi1: Virtual Network Interface Controller (VNIC) HW support")
> > Fixes: 4730f4a6c6b2 ("IB/hfi1: Activate the dummy netdev")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: Add error handling in hfi1_vnic_up() and add second fixes tag
> >
> >  drivers/infiniband/hw/hfi1/vnic_main.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/hfi1/vnic_main.c b/drivers/infiniband/hw/hfi1/vnic_main.c
> > index b183c56b7b6a4..03f8be8e9488e 100644
> > --- a/drivers/infiniband/hw/hfi1/vnic_main.c
> > +++ b/drivers/infiniband/hw/hfi1/vnic_main.c
> > @@ -457,13 +457,19 @@ static int hfi1_vnic_up(struct hfi1_vnic_vport_info *vinfo)
> >  	if (rc < 0)
> >  		return rc;
> >
> > -	hfi1_netdev_rx_init(dd);
> > +	rc = hfi1_netdev_rx_init(dd);
> > +	if (rc < 0)
> > +		goto err_remove;
> 
> Why did you check for the negative value here and didn't check below?
> 

I just copied the pattern in the nearest code.  I didn't realize until
now that it was different in both functions...  The checking isn't done
consistently in this file.

I can resend on Tuesday though if you want.

regards,
dan carpenter

  reply	other threads:[~2020-05-31 17:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 10:03 [PATCH] IB/hfi1: Fix an error code in hfi1_vnic_init() Dan Carpenter
2020-05-29 10:03 ` Dan Carpenter
2020-05-29 13:34 ` Marciniszyn, Mike
2020-05-30 14:02   ` [PATCH v2] IB/hfi1: Fix hfi1_netdev_rx_init() error handling Dan Carpenter
2020-05-30 14:02     ` Dan Carpenter
2020-05-31 10:05     ` Leon Romanovsky
2020-05-31 10:05       ` Leon Romanovsky
2020-05-31 17:36       ` Dan Carpenter [this message]
2020-05-31 17:36         ` Dan Carpenter
2020-06-01  4:24         ` Leon Romanovsky
2020-06-01  4:24           ` Leon Romanovsky
2020-06-01 12:27           ` Jason Gunthorpe
2020-06-01 12:27             ` Jason Gunthorpe
2020-06-01 12:49             ` Wan, Kaike
2020-06-01 12:49               ` Wan, Kaike
2020-06-01 14:14     ` Jason Gunthorpe
2020-06-01 14:14       ` Jason Gunthorpe
2020-06-01 18:01       ` Dan Carpenter
2020-06-01 18:01         ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200531173655.GT22511@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dennis.dalessandro@intel.com \
    --cc=dledford@redhat.com \
    --cc=grzegorz.andrejczuk@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.