From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: LinoSanfilippo@gmx.de, mlindner@marvell.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: sky2: in free_buffers() do proper checks before call of rx_clean()
Date: Fri, 13 Apr 2012 10:24:13 -0700 [thread overview]
Message-ID: <20120413102413.41c0d053@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <20120413.125954.1123124134206162716.davem@davemloft.net>
How about this instead? It moves the rx_clean out of free_buffers and
into the proper place in the unwind code.
--- a/drivers/net/ethernet/marvell/sky2.c 2012-04-12 08:07:11.572640522 -0700
+++ b/drivers/net/ethernet/marvell/sky2.c 2012-04-13 10:19:39.466839378 -0700
@@ -1630,7 +1630,8 @@ static int sky2_alloc_buffers(struct sky
if (!sky2->rx_ring)
goto nomem;
- return sky2_alloc_rx_skbs(sky2);
+ return 0;
+
nomem:
return -ENOMEM;
}
@@ -1639,8 +1640,6 @@ static void sky2_free_buffers(struct sky
{
struct sky2_hw *hw = sky2->hw;
- sky2_rx_clean(sky2);
-
if (sky2->rx_le) {
pci_free_consistent(hw->pdev, RX_LE_BYTES,
sky2->rx_le, sky2->rx_le_map);
@@ -1761,9 +1760,13 @@ static int sky2_open(struct net_device *
if (err)
goto err_out;
+ err = sky2_alloc_rx_skbs(sky2);
+ if (err)
+ goto err_clean;
+
/* With single port, IRQ is setup when device is brought up */
if (hw->ports == 1 && (err = sky2_setup_irq(hw, dev->name)))
- goto err_out;
+ goto err_clean;
sky2_hw_up(sky2);
@@ -1783,6 +1786,8 @@ static int sky2_open(struct net_device *
return 0;
+err_clean:
+ sky2_rx_clean(sky2);
err_out:
sky2_free_buffers(sky2);
return err;
@@ -2158,6 +2163,7 @@ static int sky2_close(struct net_device
sky2_hw_down(sky2);
+ sky2_rx_clean(sky2);
sky2_free_buffers(sky2);
return 0;
next prev parent reply other threads:[~2012-04-13 17:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 0:13 Lino Sanfilippo
2012-04-04 22:07 ` David Miller
2012-04-13 16:59 ` David Miller
2012-04-13 17:24 ` Stephen Hemminger [this message]
2012-04-13 17:09 ` Stephen Hemminger
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=20120413102413.41c0d053@nehalam.linuxnetplumber.net \
--to=shemminger@vyatta.com \
--cc=LinoSanfilippo@gmx.de \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mlindner@marvell.com \
--cc=netdev@vger.kernel.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
Powered by JetHome