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]
Date:	Tue, 22 May 2012 11:26:56 -0700
From:	David Daney <david.daney@...ium.com>
To:	Joe Perches <joe@...ches.com>
CC:	David Daney <ddaney.cavm@...il.com>,
	"devicetree-discuss@...ts.ozlabs.org" 
	<devicetree-discuss@...ts.ozlabs.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	Rob Herring <rob.herring@...xeda.com>,
	"David S. Miller" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mips@...ux-mips.org" <linux-mips@...ux-mips.org>,
	Fleming Andy-AFLEMING <afleming@...escale.com>
Subject: Re: [PATCH 4/5] netdev/phy: Add driver for Broadcom BCM87XX 10G Ethernet
 PHYs

On 05/22/2012 11:17 AM, Joe Perches wrote:
> On Tue, 2012-05-22 at 10:59 -0700, David Daney wrote:
>> From: David Daney<david.daney@...ium.com>
>
> trivia:

As long as we are splitting hairs...

>
>> diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
> []
>> @@ -0,0 +1,237 @@
>
>> +static int bcm87xx_of_reg_init(struct phy_device *phydev)
>> +{
>> +	const __be32 *paddr;
>> +	int len, i, ret;
>> +
>> +	if (!phydev->dev.of_node)
>> +		return 0;
>> +
>> +	paddr = of_get_property(phydev->dev.of_node,
>> +				"broadcom,c45-reg-init",&len);
>> +	if (!paddr || len<  (4 * sizeof(*paddr)))
>> +		return 0;
>> +
>> +	ret = 0;
>> +	len /= sizeof(*paddr);
>> +	for (i = 0; i<  len - 3; i += 4) {
>> +		u16 devid = be32_to_cpup(paddr + i);
>> +		u16 reg = be32_to_cpup(paddr + i + 1);
>> +		u16 mask = be32_to_cpup(paddr + i + 2);
>> +		u16 val_bits = be32_to_cpup(paddr + i + 3);
>> +		int val;
>
> These might read better as
>
> 	len /= 4;

Where did the magic value of 4 come from?

> 	for (i = 0; i<  len; i++) {
> 		u16 devid	= be32_to_cpu(*paddr++);
> 		u16 reg		= be32_to_cpu(*paddr++);
> 		u16 mask	= be32_to_cpu(*paddr++);
> 		u16 val_bits	= be32_to_cpu(*paddr++);

Is the main problem that they didn't align, or that the index was 
explicit instead of implicit?

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