lkml.org 
[lkml]   [2015]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] iio: ad_sigma_delta: cleanup wait_for_completion return handling
On Mon, 02 Feb 2015, Lars-Peter Clausen wrote:

> On 02/02/2015 09:37 AM, Nicholas Mc Guire wrote:
>> return type of wait_for_completion_timeout is unsigned long not int, rather
>> than introducing a new variable the wait_for_completion_timeout is moved
>> into the if condition as the return value is only used to detect timeout.
>
> But the return value is bound by the timeout parameter and we know that
> fits into a int. And I really dont like moving the function call into the
> if condition, so unless there is some additional explanation why this is
> necessary and should be done I'm inclined to nack this.
>

well having correct types is important for all static code chekcers
and I did not want to add a new variable just for this case
simply because the result is only relevant in the == 0 case
anyway.

I do think that the types being assigned should correct with respect
to the API definition even if it fits in this case.

>>
>> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
>> ---
>>
>> Aside from the fixup of the wait_for_completion_timeout handling
>> a minor coding style issue in the else branch was fixed - the {} is
>> not needed for the one-line body.
>
> If one of the branches of a conditional statement has braces the other
> branches should also have braces. This is documented in
> Documentation/CodingStyle.

my bad - it is not uncommon to be asymetric - but you are right that Chapter 3
states it should not be asymetric in this case - will remove that.

given the botched braces this needs to be redone - let me know if moving
it into the condition is ok (its not uncommon) or if an additional variable
of type unsigned long is the prefered solution.

thanks for your review !

thx!
hofrat



\
 
 \ /
  Last update: 2015-02-02 11:01    [W:0.939 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site