All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Eduardo Barretto <edusbarretto@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: wlan-ng: hfa384x_usb: fixed an 'else' statement coding style issue
Date: Mon, 15 Dec 2014 13:28:31 -0800	[thread overview]
Message-ID: <1418678911.2674.21.camel@perches.com> (raw)
In-Reply-To: <20141215205355.GA5831@archer>

On Mon, 2014-12-15 at 18:53 -0200, Eduardo Barretto wrote:
> Thank you for the quick feedback. 
> It was my first patch to the kernel and I wanted to be sure it would get right to the community.
> I'll be making a version two with the consideration you brought me.

the code today is:

{
	switch (prdcode) {
	case [...]
		return 1;
	default:
		if (prdcode < 0x1000) {
			printk(msg1);
			return 1;
		else
			printk(msg2);
			return 0;
	}
	return 0;	/* avoid compiler noise */
}

I think this code does not needs changing.
I think more modern compilers don't even warn
when the last return 0; isn't there.

If it were to be changed, I'd probably write it like:

{
	switch (prdcode) {
	case [...]
		return 1;
	default:
		if (prdcode < 0x1000) {
			printk(msg1);
			return 1;
		}
		break;
	}

	printk(msg2);
	return 0;
}

but I wouldn't bother.


      reply	other threads:[~2014-12-15 21:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  2:02 [PATCH] Staging: wlan-ng: hfa384x_usb: fixed an 'else' statement coding style issue Eduardo Barretto
2014-12-15  2:11 ` Joe Perches
2014-12-15 20:53   ` Eduardo Barretto
2014-12-15 21:28     ` Joe Perches [this message]

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=1418678911.2674.21.camel@perches.com \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=edusbarretto@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.