mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: dd diasemi <dd.diasemi@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: drivers/regulator/core.c: Fixes mapping inside regulator_mode_to_status() and makes it returning -EINVAL on invalid input.
Date: Mon, 9 Jan 2012 20:07:34 +0000	[thread overview]
Message-ID: <20120109200734.GB30766@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <CAEqHmAte=rvhjGUEdMgNQKfvPxSVTFR5TfWy13VPEhZj0T53KQ@mail.gmail.com>

On Mon, Jan 09, 2012 at 07:20:50PM +0000, dd diasemi wrote:
> On Mon, Jan 9, 2012 at 4:14 PM, Mark Brown

> >>       default:
> >> -             return 0;
> >> +             return -EINVAL;

> > This behaviour is deliberate.

> For this moment, the only usage is in one file in
> wm831x_aldo_get_status() and wm831x_gp_ldo_get_status():
> 	ret = wm831x_aldo_get_mode(rdev);
> 	if (ret < 0)
> 		return ret;
> 	else
> 		return regulator_mode_to_status(ret);

> The usage mistreats the signed value 'ret' as wm831x_aldo_get_mode()
> always returns 0 on communication error. It effects in response as if
> the regulator was off.

> If that behaviour is deliberate, I would suggest to make it explicit:
>  	default:
> -		return 0;
> +		return REGULATOR_STATUS_OFF;

That's not the deliberate behaviour, the deliberate behaviour is to
return no mode if we didn't find one.

  reply	other threads:[~2012-01-09 20:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 12:12 Krystian Garbaciak
2012-01-09 16:14 ` Mark Brown
2012-01-09 19:20   ` dd diasemi
2012-01-09 20:07     ` Mark Brown [this message]
2012-01-10  0:11       ` dd diasemi
2012-01-10  0:14         ` Mark Brown
2012-01-10 17:09           ` dd diasemi
2012-01-10 17:14             ` 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=20120109200734.GB30766@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=dd.diasemi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome