mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Ariana Lazar <ariana.lazar@microchip.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: dac: mcp47feb02: Fix Vref validation [1-999] case
Date: Mon, 9 Mar 2026 18:50:15 +0200	[thread overview]
Message-ID: <aa76Rz-I-FRpagWU@ashevche-desk.local> (raw)
In-Reply-To: <20260309-mcp47feb02-fix1-v2-1-6a5ef30e4b27@microchip.com>

On Mon, Mar 09, 2026 at 02:12:23PM +0200, Ariana Lazar wrote:
> Store reference voltages in uV instead of mV to avoid invalid error code
> in dev_err_probe() call. Vref variables store the actual value returned by
> devm_regulator_get_enable_read_voltage() function instead of the results of
> dividing it by MILLI. The corner case [1-999] divided by MILLI of the
> voltage reference variable value would become 0 is covered too.

...

> +	vref_uV = 0;
>  	ret = devm_regulator_get_enable_read_voltage(dev, "vref");
>  	if (ret > 0) {
> +		vref_uV = ret;
>  		data->use_vref = true;
>  	} else {
>  		dev_dbg(dev, "using internal band gap as voltage reference.\n");

>  	}

Thanks, but in some cases this will be rewritten. Why not put the assignment
into the 'else' branch?

...


> +		vref1_uV = 0;

Ditto.

>  		ret = devm_regulator_get_enable_read_voltage(dev, "vref1");
>  		if (ret > 0) {
> -			vref1_mV = ret / MILLI;
> +			vref1_uV = ret;
>  			data->use_vref1 = true;
>  		} else {
>  			dev_dbg(dev, "using internal band gap as voltage reference 1.\n");

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-03-09 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 12:12 Ariana Lazar
2026-03-09 16:50 ` Andy Shevchenko [this message]

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=aa76Rz-I-FRpagWU@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy@kernel.org \
    --cc=ariana.lazar@microchip.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®