public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: aquini@linux.com, kernel-janitors@vger.kernel.org,
	David Miller <davem@davemloft.net>,
	Andy Gospodarek <andy@greyhouse.net>,
	shemminger@vyatta.com, netdev@vger.kernel.org,
	Nicolas Kaiser <nikai@nikai.net>
Subject: Re: [PATCH] net/bonding: adjust codingstyle for bond_3ad files
Date: Tue, 10 May 2011 02:11:38 +0000	[thread overview]
Message-ID: <1304993498.19586.86.camel@Joe-Laptop> (raw)
In-Reply-To: <23511.1304992840@death>

On Mon, 2011-05-09 at 19:00 -0700, Jay Vosburgh wrote:
> {
> 	u32 bandwidth;
> 
> 	if (aggregator->num_of_ports) {
> 		switch (...) {
> 		case AD_LINK_SPEED_WHATEVER:
> 			bandwidth = something;
> 			break;
> 		default:
> 			pr_warn or WARN(1, ...);
> 			bandwidth = 0;
> 		}
> 		return bandwidth;
> 	}
> 	return 0;
> }

My preference is to return early and reduce indentation.

It can make things like pr_<foo> or WARN more likely to
fit on a single.

{
	int bandwidth;

	if (!aggregator->num_of_ports)
		return 0;

	switch (...) {
	case FOO:
		bandwidth = bar;
		break;
	...
	}

	return bandwidth;
}



  reply	other threads:[~2011-05-10  2:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06 11:50 [PATCH] net/bonding: adjust codingstyle for bond_3ad files Rafael Aquini
2011-05-06 13:01 ` Nicolas Kaiser
2011-05-06 14:56   ` Rafael Aquini
2011-05-07  1:27 ` Rafael Aquini
2011-05-07  1:51   ` Joe Perches
2011-05-07 17:31     ` Rafael Aquini
2011-05-07 18:02       ` Joe Perches
2011-05-07 19:35         ` matt mooney
2011-05-07 20:24           ` Joe Perches
2011-05-08 23:08           ` Håkon Løvdal
2011-05-08 23:10             ` David Miller
2011-05-09  0:08               ` Håkon Løvdal
2011-05-09  0:12                 ` David Miller
2011-05-09  1:30                   ` Håkon Løvdal
2011-05-07 21:25         ` Jay Vosburgh
2011-05-07 21:37           ` Rafael Aquini
2011-05-10  0:08 ` Rafael Aquini
2011-05-10  0:15   ` Joe Perches
2011-05-10  2:00   ` Jay Vosburgh
2011-05-10  2:11     ` Joe Perches [this message]
2011-05-10 12:22     ` Rafael Aquini

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=1304993498.19586.86.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=andy@greyhouse.net \
    --cc=aquini@linux.com \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikai@nikai.net \
    --cc=shemminger@vyatta.com \
    /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