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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=U2_G=6yPndd0Fdd=e0zoM6x+h0Zqqyt6qcWx3TDohSdg@mail.gmail.com>
Date:   Wed, 18 Apr 2018 08:56:22 -0700
From:   Doug Anderson <dianders@...omium.org>
To:     Javier Martinez Canillas <javier@...hile0.org>
Cc:     Mark Brown <broonie@...nel.org>,
        David Collins <collinsd@...eaurora.org>,
        Evan Green <evgreen@...omium.org>, swboyd@...omium.org,
        linux-omap <linux-omap@...r.kernel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Tony Lindgren <tony@...mide.com>,
        Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] regulator: Don't return or expect -errno from of_map_mode()

Hi,

On Wed, Apr 18, 2018 at 12:15 AM, Javier Martinez Canillas
<javier@...hile0.org> wrote:
>> @@ -124,11 +124,12 @@ static void of_get_regulation_constraints(struct device_node *np,
>>
>>         if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
>>                 if (desc && desc->of_map_mode) {
>> -                       ret = desc->of_map_mode(pval);
>> -                       if (ret == -EINVAL)
>> +                       unsigned int mode = desc->of_map_mode(pval);
>
> I think the convention is to always declare local variables at the
> start of the function? Although I couldn't find anything in the coding
> style document...

I haven't seen this as a consistent kernel convention.  It seems a bit
up to the subsystem and/or driver maintainer.  However, I'm happy to
put it up at the top if it makes people happy.


>> @@ -163,12 +164,14 @@ static void of_get_regulation_constraints(struct device_node *np,
>>                 if (!of_property_read_u32(suspend_np, "regulator-mode",
>>                                           &pval)) {
>>                         if (desc && desc->of_map_mode) {
>> -                               ret = desc->of_map_mode(pval);
>> -                               if (ret == -EINVAL)
>> +                               unsigned int mode = desc->of_map_mode(pval);
>> +
>> +                               mode = desc->of_map_mode(pval);
>
> You are calling .of_map_mode and assigning the return value twice here.

Dang it, thanks for catching.


-Doug

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ