lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1304993498.19586.86.camel@Joe-Laptop>
Date:	Mon, 09 May 2011 19:11:38 -0700
From:	Joe Perches <joe@...ches.com>
To:	Jay Vosburgh <fubar@...ibm.com>
Cc:	aquini@...ux.com, kernel-janitors@...r.kernel.org,
	David Miller <davem@...emloft.net>,
	Andy Gospodarek <andy@...yhouse.net>, shemminger@...tta.com,
	netdev@...r.kernel.org, Nicolas Kaiser <nikai@...ai.net>
Subject: Re: [PATCH] net/bonding: adjust codingstyle for bond_3ad files

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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ