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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux