netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: shemminger@linux-foundation.org
Cc: netdev@vger.kernel.org, Ariel.Hendel@sun.com,
	greg.onufer@sun.com, jeff@garzik.org, Ashley.Saulsbury@sun.com,
	Matheos.Worku@sun.com
Subject: Re: [PATCH]: Third (final?) release of Sun Neptune driver
Date: Fri, 05 Oct 2007 16:07:00 -0700 (PDT)	[thread overview]
Message-ID: <20071005.160700.38700247.davem@davemloft.net> (raw)
In-Reply-To: <20071005083556.7076dd43@freepuppy.rosehill>

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Fri, 5 Oct 2007 08:35:56 -0700

> > +		BUG_ON(!page);
> 
> BUG_ON checks for NULL are useless if the code following is
> just going to dereference the pointer anyway. 

Agreed, all such cases fixed in the patch below, thanks!

> > +	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> > +		tb = &rp->tx_buffs[idx];
> > +		BUG_ON(tb->skb != NULL);
> 
> > +		np->ops->unmap_page(np->device, tb->mapping,
> > +				    skb_shinfo(skb)->frags[i].size,
> > +				    DMA_TO_DEVICE);
> 
> Shouldn't this be skb_shinfo(tb->skb)->frags...

Nope, look at the logic, the assertion is making surethat
tb->skb == NULL.

When transmitting, the first descriptor holds the SKB pointer
and the rest of the descriptors for that packet explicitly
set the slots' SKB to NULL.

> > +		idx = NEXT_TX(rp, idx);
> > +	}
> > +
> > +	dev_kfree_skb(skb);
> 
> Should be dev_kfree_skb_any() if you plan on supporting
> netconsole.

I have no such plans at this time :-)

I think I've covered all of your feedback from this email,
thanks again for the review.

>From 418d57645f3132241eb180f9d381ef6541745e23 Mon Sep 17 00:00:00 2001
From: David S. Miller <davem@sunset.davemloft.net>
Date: Fri, 5 Oct 2007 16:04:16 -0700
Subject: [PATCH] [NIU]: Remove BUG_ON() NULL pointer checks.

As mentioned by Stephen Hemminger, these are superfluous
if we are about to dereference the thing anyways.  The
OOPS has the same effect and will show the problem just
as clearly.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/niu.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 450d95e..c29235e 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -2134,7 +2134,6 @@ static int niu_rx_pkt_ignore(struct niu *np, struct rx_ring_info *rp)
 		addr = (val & RCR_ENTRY_PKT_BUF_ADDR) <<
 			RCR_ENTRY_PKT_BUF_ADDR_SHIFT;
 		page = niu_find_rxpage(rp, addr, &link);
-		BUG_ON(!page);
 
 		rcr_size = rp->rbr_sizes[(val & RCR_ENTRY_PKTBUFSZ) >>
 					 RCR_ENTRY_PKTBUFSZ_SHIFT];
@@ -2185,7 +2184,6 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
 		addr = (val & RCR_ENTRY_PKT_BUF_ADDR) <<
 			RCR_ENTRY_PKT_BUF_ADDR_SHIFT;
 		page = niu_find_rxpage(rp, addr, &link);
-		BUG_ON(!page);
 
 		rcr_size = rp->rbr_sizes[(val & RCR_ENTRY_PKTBUFSZ) >>
 					 RCR_ENTRY_PKTBUFSZ_SHIFT];
@@ -2294,8 +2292,6 @@ static int release_tx_packet(struct niu *np, struct tx_ring_info *rp, int idx)
 	u64 tx_flags;
 	int i, len;
 
-	BUG_ON(!skb);
-
 	tp = (struct tx_pkt_hdr *) skb->data;
 	tx_flags = le64_to_cpup(&tp->flags);
 
-- 
1.5.3.3


  parent reply	other threads:[~2007-10-05 23:07 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 10:12 [PATCH]: Third (final?) release of Sun Neptune driver David Miller
2007-10-05 15:35 ` Stephen Hemminger
2007-10-05 22:49   ` David Miller
2007-10-05 22:54   ` David Miller
2007-10-05 23:31     ` Jeff Garzik
2007-10-05 22:56   ` David Miller
2007-10-05 23:07   ` David Miller [this message]
2007-10-05 23:24   ` David Miller
2007-10-05 23:32     ` Jeff Garzik
2007-10-05 23:27   ` David Miller
2007-10-05 15:39 ` Stephen Hemminger
2007-10-05 21:12   ` David Miller
2007-10-05 21:18     ` Stephen Hemminger
2007-10-05 23:30       ` David Miller
2007-10-05 15:40 ` Stephen Hemminger
2007-10-05 21:12   ` David Miller
2007-10-05 21:14     ` Jeff Garzik
2007-10-05 21:21       ` Stephen Hemminger
2007-10-05 21:40         ` David Miller
2007-10-05 21:38       ` David Miller
2007-10-05 23:42   ` David Miller
2007-10-05 15:43 ` Stephen Hemminger
2007-10-06  0:04   ` David Miller
2007-10-06  0:28     ` Stephen Hemminger
2007-10-06  0:46       ` David Miller
2007-10-06  8:32       ` Johannes Berg
2007-10-05 16:46 ` Ingo Oeser
2007-10-05 16:49   ` Ingo Oeser
2007-10-06  0:08     ` David Miller
2007-10-08 16:04       ` Oliver Hartkopp
2007-10-05 16:55   ` Jeff Garzik
2007-10-05 17:45   ` Matheos Worku
2007-10-05 21:18   ` David Miller
2007-10-05 21:20   ` David Miller
     [not found]   ` <470677A0.5060502@sun.com>
2007-10-05 21:24     ` David Miller
2007-10-05 22:18   ` Matheos Worku
2007-10-05 22:43     ` David Miller
2007-10-06  0:10   ` David Miller
2007-10-08 16:01 ` Oliver Hartkopp
2007-10-08 23:08   ` 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=20071005.160700.38700247.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Ariel.Hendel@sun.com \
    --cc=Ashley.Saulsbury@sun.com \
    --cc=Matheos.Worku@sun.com \
    --cc=greg.onufer@sun.com \
    --cc=jeff@garzik.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).