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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251103094045.73a061ea@bootlin.com>
Date: Mon, 3 Nov 2025 09:40:45 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Wolfram Sang <wsa+renesas@...g-engineering.com>, Jonathan Cameron
 <jic23@...nel.org>, David Lechner <dlechner@...libre.com>, Nuno
 Sá <nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>, Geert Uytterhoeven
 <geert+renesas@...der.be>, Magnus Damm <magnus.damm@...il.com>, Liam
 Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
 linux-iio@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
 devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, Pascal Eberhard
 <pascal.eberhard@...com>, Miquel Raynal <miquel.raynal@...tlin.com>, Thomas
 Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v2 2/4] iio: adc: Add support for the Renesas RZ/N1 ADC

Hi Andy,

On Thu, 30 Oct 2025 11:00:12 +0200
Andy Shevchenko <andriy.shevchenko@...el.com> wrote:

...
> 
> > +	ret = devm_regulator_get_enable_optional(dev, avdd_name);
> > +	if (ret < 0) {
> > +		if (ret != -ENODEV)
> > +			return dev_err_probe(dev, ret,
> > +					     "Failed to get '%s' regulator\n",
> > +					     avdd_name);
> > +		return 0;
> > +	}  
> 
> 	if (ret == -ENODEV)
> 		return dev_err_probe(); // takes less LoCs
> 	if (ret < 0) // do we need ' < 0' part?
> 		return 0;
> 

Well, I need to abort on error returned by devm_regulator_get_enable_optional()
but I need also to filter out the ENODEV error.

ENODEV, returned by devm_regulator_get_enable_optional(), means that the
regulator is not present. This should not be seen as an error by the caller.
Indeed, the regulator is not present and so, the related ADC core will not
be used. This is not an error from the caller perspective.

The code you proposed is not correct regarding this point.

Instead of my original code, I can propose the following:
	if (ret < 0) {
		if (ret == -ENODEV)
			return 0;

		return dev_err_probe(dev, ret,
				     "Failed to get '%s' regulator\n",
				     avdd_name);
	}

What do you think about it?

For other comments you have sent, I agree with them and I will take them into
account in the next iteration.

Best regards,
Hervé


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ