netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@redhat.com>
To: netdev@vger.kernel.org
Cc: Nikolay Aleksandrov <nikolay@redhat.com>,
	linux-net-drivers@solarflare.com,
	Shradha Shah <sshah@solarflare.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ben Hutchings <ben@decadent.org.uk>
Subject: Re: [PATCH net] sfc: fix calling of free_irq with 0 argument
Date: Tue, 06 May 2014 17:34:38 +0200	[thread overview]
Message-ID: <5369010E.2060908@redhat.com> (raw)
In-Reply-To: <1399380556-25797-1-git-send-email-nikolay@redhat.com>

On 05/06/2014 02:49 PM, Nikolay Aleksandrov wrote:
> If the sfc driver is in legacy interrupt mode (either explicitly by
> using interrupt_mode module param or by falling back to it) it will
> hit a warning at kernel/irq/manage.c because it will try to free irq 0
> in efx_nic_fini_interrupt() since the MSI interrupts were freed always,
> but in legacy irq mode they're == 0. So fix it by checking if we
> actually have an interrupt allocated and only then free it.
> 
> CC: <linux-net-drivers@solarflare.com>
> CC: Shradha Shah <sshah@solarflare.com>
> CC: David S. Miller <davem@davemloft.net>
> 
> Reported-by: Zenghui Shi <zshi@redhat.com>
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
> ---
> There're other ways to fix this as well, but I chose this one as it follows
> the logic in the code. Also I saw it used in a few places to check if
> there's an IRQ allocated for that channel.
> 
>  drivers/net/ethernet/sfc/nic.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
> index 32d969e857f7..cab627defbc3 100644
> --- a/drivers/net/ethernet/sfc/nic.c
> +++ b/drivers/net/ethernet/sfc/nic.c
> @@ -158,7 +158,9 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
>  
>  	/* Disable MSI/MSI-X interrupts */
>  	efx_for_each_channel(channel, efx)
> -		free_irq(channel->irq, &efx->msi_context[channel->channel]);
> +		if (channel->irq)
> +			free_irq(channel->irq,
> +				 &efx->msi_context[channel->channel]);
>  
>  	/* Disable legacy interrupt */
>  	if (efx->legacy_irq)
> 
And of course if I had looked deeper in the history of that function I would've
seen that the code was like that before commit
1899c111a535e43046b14ae13639747d9d2544d6 ("sfc: Fix IRQ cleanup in case of a
probe failure"). So including Ben on the CC list as he's the author of that commit.

Cheers,
 Nik

  reply	other threads:[~2014-05-06 15:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 12:49 [PATCH net] sfc: fix calling of free_irq with 0 argument Nikolay Aleksandrov
2014-05-06 15:34 ` Nikolay Aleksandrov [this message]
2014-05-07 19:39 ` David Miller
2014-05-07 19:45   ` Nikolay Aleksandrov

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=5369010E.2060908@redhat.com \
    --to=nikolay@redhat.com \
    --cc=ben@decadent.org.uk \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=sshah@solarflare.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).