All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Mark Brown <broonie@kernel.org>,
	David Collins <collinsd@codeaurora.org>,
	Evan Green <evgreen@chromium.org>,
	swboyd@chromium.org, linux-omap <linux-omap@vger.kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] regulator: Don't return or expect -errno from of_map_mode()
Date: Wed, 18 Apr 2018 08:56:22 -0700	[thread overview]
Message-ID: <CAD=FV=U2_G=6yPndd0Fdd=e0zoM6x+h0Zqqyt6qcWx3TDohSdg@mail.gmail.com> (raw)
In-Reply-To: <CABxcv=kx9KVJYPyRFBR5mzGgezoSmjrXpGa214E2v85YJYd1+Q@mail.gmail.com>

Hi,

On Wed, Apr 18, 2018 at 12:15 AM, Javier Martinez Canillas
<javier@dowhile0.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

  reply	other threads:[~2018-04-18 15:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18  3:31 [PATCH v2] regulator: Don't return or expect -errno from of_map_mode() Douglas Anderson
2018-04-18  7:15 ` Javier Martinez Canillas
2018-04-18 15:56   ` Doug Anderson [this message]
2018-04-18 16:48     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD=FV=U2_G=6yPndd0Fdd=e0zoM6x+h0Zqqyt6qcWx3TDohSdg@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=broonie@kernel.org \
    --cc=collinsd@codeaurora.org \
    --cc=evgreen@chromium.org \
    --cc=javier@dowhile0.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=swboyd@chromium.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.