From: Joe Perches <joe@perches.com>
To: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
Cc: "Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"Allan, Bruce W" <bruce.w.allan@intel.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"gospo@redhat.com" <gospo@redhat.com>,
"bphilips@novell.com" <bphilips@novell.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"gospo@redhat.com" <gospo@redhat.com>,
"bphilips@novell.com" <bphilips@novell.com>
Subject: RE: [net-next-2.6 25/27] e1000e: static analysis tools complain of a possible null ptr p dereference
Date: Fri, 10 Dec 2010 11:58:31 -0800 [thread overview]
Message-ID: <1292011111.24978.34.camel@Joe-Laptop> (raw)
In-Reply-To: <EA929A9653AAE14F841771FB1DE5A136602D54FD2F@rrsmsx501.amr.corp.intel.com>
On Fri, 2010-12-10 at 12:35 -0700, Tantilov, Emil S wrote:
> >On Fri, 2010-12-10 at 02:06 -0800, Jeff Kirsher wrote:
> >> diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
> >[]
> >> + default:
> >> + data[i] = 0;
> >> + continue;
> >> + break;
> >Using
> > continue;
> > break;
> >is odd and unhelpful.
> >Just continue; is sufficient and clear.
> It's odd and without consequence but not necessarily "unhelpful" as it
> can protect from bugs in case someone was to add another case
> statement.
continue statements are not fall-through.
Adding another case statement in the switch below
this case label would work just fine.
> While unlikely, bugs in switch statements due to missing breaks are
> not unheard of.
True, but that's not this case.
> Looking at the kernel source there is no consistency as far as break
> in the default: case is concerned.
It's not the break, it's the break after continue that's odd.
Glancing through the source code using
$ grep -rP --include=*.[ch] -B 3 "\bcontinue\s*;\s*break\s*;" *
this is a pretty unusual coding style.
Most all of the matches are like:
if (condition)
continue;
break;
Your choice, your code. I just think it's ugly
as well as odd and unhelpful.
cheers, Joe
next prev parent reply other threads:[~2010-12-10 19:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-10 10:06 [net-next-2.6 24/27] e1000e: minor error message corrections Jeff Kirsher
2010-12-10 10:06 ` [net-next-2.6 25/27] e1000e: static analysis tools complain of a possible null ptr p dereference Jeff Kirsher
2010-12-10 12:44 ` Joe Perches
2010-12-10 19:35 ` Tantilov, Emil S
2010-12-10 19:58 ` Joe Perches [this message]
2010-12-10 20:16 ` David Miller
2010-12-10 10:06 ` [net-next-2.6 26/27] e1000e: increment the driver version Jeff Kirsher
2010-12-10 10:06 ` [net-next-2.6 27/27] igb: Add new function to read part number from EEPROM in string format Jeff Kirsher
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=1292011111.24978.34.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=bphilips@novell.com \
--cc=bruce.w.allan@intel.com \
--cc=davem@davemloft.net \
--cc=emil.s.tantilov@intel.com \
--cc=gospo@redhat.com \
--cc=jeffrey.t.kirsher@intel.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