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  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:   Sun, 31 Mar 2019 01:20:17 -0500
From:   Alex Elder <elder@...aro.org>
To:     Joe Perches <joe@...ches.com>,
        Will Cunningham <wjcunningham7@...il.com>, johan@...nel.org
Cc:     devel@...verdev.osuosl.org, elder@...nel.org,
        linux-kernel@...r.kernel.org, greybus-dev@...ts.linaro.org
Subject: Re: [greybus-dev] [PATCH] Staging: greybus: usb: Fixed a coding style
 error

On 3/31/19 1:04 AM, Joe Perches wrote:
> On Sun, 2019-03-31 at 01:30 -0400, Will Cunningham wrote:
>> Line was >80 characters.
> []
>> diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c
> []
>> @@ -169,8 +169,8 @@ static int gb_usb_probe(struct gbphy_device *gbphy_dev,
>>  		return -ENOMEM;
>>  
>>  	connection = gb_connection_create(gbphy_dev->bundle,
>> -					  le16_to_cpu(gbphy_dev->cport_desc->id),
>> -					  NULL);
>> +				le16_to_cpu(gbphy_dev->cport_desc->id),
>> +				NULL);
> 
> Blind adherence to 80 column limits leads to poor looking
> code.  Especially with longish identifier lengths.

I agree.  If it were me, I'd use a local variable.  For example:

        struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc;

	...

        connection = gb_connection_create(gbphy_dev->bundle,
                                          le16_to_cpu(cport_desc->id), NULL);

Or maybe better:

	u16 cport_id = le16_to_cpu(gbphy_dev->cport_desc->id);

	...

        connection = gb_connection_create(gbphy_dev->bundle, cport_id, NULL);

					-Alex




> 
> Another way to do this, which is not necessarily actually
> better is to position the left side of the assignment on a
> separate line like:
> 
> 	connection =
> 		 gb_connection_create(gbphy_dev->bundle,
> 				      le16_to_cpu(gbphy_dev->cport_desc->id),
> 
> Is that better?  <shrug>  I prefer the original.
> It was better before as it was aligned to open parenthesis.
> 
> 
> _______________________________________________
> greybus-dev mailing list
> greybus-dev@...ts.linaro.org
> https://lists.linaro.org/mailman/listinfo/greybus-dev
> 

Powered by blists - more mailing lists