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: <aQh4RFg2NlUXlyaz@smile.fi.intel.com>
Date: Mon, 3 Nov 2025 11:39:16 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Herve Codina <herve.codina@...tlin.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

On Mon, Nov 03, 2025 at 09:40:45AM +0100, Herve Codina wrote:
> 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.

Yeah, sorry for that, but I think you got the idea...

The (working) solution should be like this:

	if (ret == -ENODEV)
		return 0;
	if (ret < 0) // do we need ' < 0' part?
		return dev_err_probe(); // takes less LoCs

> 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?

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ