linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Veerasenareddy Burru <vburru@marvell.com>,
	Abhijit Ayarekar <aayarekar@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Satananda Burla <sburla@marvell.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] octeon_ep: Fix irq releasing in the error handling path of octep_request_irqs()
Date: Tue, 17 May 2022 10:35:26 +0200	[thread overview]
Message-ID: <eec880be771e75d60ead01cbf71d83fe070ccde8.camel@redhat.com> (raw)
In-Reply-To: <20220517052859.GN4009@kadam>

On Tue, 2022-05-17 at 08:28 +0300, Dan Carpenter wrote:
> On Sun, May 15, 2022 at 05:56:45PM +0200, Christophe JAILLET wrote:
> > For the error handling to work as expected, the index in the
> > 'oct->msix_entries' array must be tweaked because, when the irq are
> > requested there is:
> > 	msix_entry = &oct->msix_entries[i + num_non_ioq_msix];
> > 
> > So in the error handling path, 'i + num_non_ioq_msix' should be used
> > instead of 'i'.
> > 
> > The 2nd argument of free_irq() also needs to be adjusted.
> > 
> > Fixes: 37d79d059606 ("octeon_ep: add Tx/Rx processing and interrupt support")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > I think that the wording above is awful, but I'm sure you get it.
> > Feel free to rephrase everything to have it more readable.
> > ---
> >  drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> > index 6b60a03574a0..4dcae805422b 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> > @@ -257,10 +257,12 @@ static int octep_request_irqs(struct octep_device *oct)
> >  
> >  	return 0;
> >  ioq_irq_err:
> > +	i += num_non_ioq_msix;
> >  	while (i > num_non_ioq_msix) {
> 
> This makes my mind hurt so badly.  Can we not just have two variables
> for the two different loops instead of re-using i?
> 
> >  		--i;
> >  		irq_set_affinity_hint(oct->msix_entries[i].vector, NULL);
> > -		free_irq(oct->msix_entries[i].vector, oct->ioq_vector[i]);
> > +		free_irq(oct->msix_entries[i].vector,
> > +			 oct->ioq_vector[i - num_non_ioq_msix]);
> >  	}
> 
> ioq_irq_err:
>         while (--j >= 0) {
>                 ioq_vector = oct->ioq_vector[j];
>                 msix_entry = &oct->msix_entries[j + num_non_ioq_msix];
> 
>                 irq_set_affinity_hint(msix_entry->vector, NULL);
>                 free_irq(msix_entry->vector, ioq_vector);
>         }
> 
> regards,
> dan carpenter

I agree the above would be more readable. @Christophe: could you please
refactor the code as per Dan's suggestion?

Thanks!

Paolo


  reply	other threads:[~2022-05-17  8:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15 15:54 [PATCH 0/2] octeon_ep: Fix the error handling path of octep_request_irqs() Christophe JAILLET
2022-05-15 15:56 ` Christophe JAILLET
2022-05-15 15:56 ` [PATCH 1/2] octeon_ep: Fix a memory leak in " Christophe JAILLET
2022-05-16 22:06   ` [EXT] " Veerasenareddy Burru
2022-05-15 15:56 ` [PATCH 2/2] octeon_ep: Fix irq releasing " Christophe JAILLET
2022-05-16 22:14   ` [EXT] " Veerasenareddy Burru
2022-05-17  5:28   ` Dan Carpenter
2022-05-17  8:35     ` Paolo Abeni [this message]
2022-05-17 20:12       ` Christophe JAILLET

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=eec880be771e75d60ead01cbf71d83fe070ccde8.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=aayarekar@marvell.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sburla@marvell.com \
    --cc=vburru@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).