netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Mike McCormack <mikem@ring3k.org>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] skge: Make sure both ports initialize correctly
Date: Wed, 30 Sep 2009 17:28:21 -0700	[thread overview]
Message-ID: <20090930172821.7c6bd127@s6510> (raw)
In-Reply-To: <4ABA27AC.7030207@ring3k.org>

On Wed, 23 Sep 2009 22:50:36 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> If allocation of the second ports fails, make sure that hw->ports
>  is not 2 otherwise we'll crash trying to access the second port.
> 
> This fix is copied from a similar fix in the sky2 driver (ca519274...),
> but is untested, as I don't have a skge card.
> 
> Signed-off-by: Mike McCormack <mikem@ring3k.org>
> ---
>  drivers/net/skge.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/skge.c b/drivers/net/skge.c
> index 62e852e..21b816f 100644
> --- a/drivers/net/skge.c
> +++ b/drivers/net/skge.c
> @@ -3982,14 +3982,17 @@ static int __devinit skge_probe(struct pci_dev *pdev,
>  	}
>  	skge_show_addr(dev);
>  
> -	if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) {
> -		if (register_netdev(dev1) == 0)
> +	if (hw->ports > 1) {
> +		dev1 = skge_devinit(hw, 1, using_dac);
> +		if (dev1 && register_netdev(dev1) == 0)
>  			skge_show_addr(dev1);
>  		else {
>  			/* Failure to register second port need not be fatal */
>  			dev_warn(&pdev->dev, "register of second port failed\n");
>  			hw->dev[1] = NULL;
> -			free_netdev(dev1);
> +			hw->ports = 1;
> +			if (dev1)
> +				free_netdev(dev1);
>  		}
>  	}
>  	pci_set_drvdata(pdev, hw);

Looks good.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>

  reply	other threads:[~2009-10-01  0:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 13:50 [PATCH] skge: Make sure both ports initialize correctly Mike McCormack
2009-10-01  0:28 ` Stephen Hemminger [this message]
2009-10-01  3:04   ` David Miller

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=20090930172821.7c6bd127@s6510 \
    --to=shemminger@vyatta.com \
    --cc=mikem@ring3k.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /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).