Thread (5 messages) flat view 5 messages, 3 authors, 2011-05-10

Re: [PATCH] net/bonding: adjust codingstyle for bond_3ad files

From: Joe Perches <joe@perches.com>
Date: 2011-05-10 02:11:40
Also in: kernel-janitors

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;
}

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help