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: <ZvV3Bx2BdnZZS9bZ@smile.fi.intel.com>
Date: Thu, 26 Sep 2024 18:00:23 +0300
From: Andy Shevchenko <andy@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Antoniu Miclaus <antoniu.miclaus@...log.com>,
	Jonathan Cameron <jic23@...nel.org>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Michael Hennerich <Michael.Hennerich@...log.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>, Nuno Sa <nuno.sa@...log.com>,
	Olivier Moysan <olivier.moysan@...s.st.com>,
	Uwe Kleine-König <ukleinek@...nel.org>,
	Marcelo Schmitt <marcelo.schmitt@...log.com>,
	João Paulo Gonçalves <joao.goncalves@...adex.com>,
	Mike Looijmans <mike.looijmans@...ic.nl>,
	Dumitru Ceclan <mitrutzceclan@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	Alisa-Dariana Roman <alisadariana@...il.com>,
	Sergiu Cuciurean <sergiu.cuciurean@...log.com>,
	Dragos Bogdan <dragos.bogdan@...log.com>, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	linux-pwm@...r.kernel.org
Subject: Re: [PATCH 6/7] iio: adc: ad485x: add ad485x driver

On Thu, Sep 26, 2024 at 04:39:18PM +0200, David Lechner wrote:
> On Mon, Sep 23, 2024 at 12:17 PM Antoniu Miclaus
> <antoniu.miclaus@...log.com> wrote:

...

> > +static int ad485x_find_opt(bool *field, u32 size, u32 *ret_start)
> > +{
> > +       int i, cnt = 0, max_cnt = 0, start, max_start = 0;
> > +
> > +       for (i = 0, start = -1; i < size; i++) {
> > +               if (field[i] == 0) {
> > +                       if (start == -1)
> > +                               start = i;
> > +                       cnt++;
> > +               } else {
> > +                       if (cnt > max_cnt) {
> > +                               max_cnt = cnt;
> > +                               max_start = start;
> > +                       }
> > +                       start = -1;
> > +                       cnt = 0;
> > +               }
> > +       }
> > +
> > +       if (cnt > max_cnt) {
> > +               max_cnt = cnt;
> > +               max_start = start;
> > +       }
> > +
> > +       if (!max_cnt)
> > +               return -EIO;
> 
> EIO seems an odd choice since this function doesn't actually do any
> I/O. Maybe EINVAL would be better?

I would even go with -ENOENT as function called 'find'.

> > +       *ret_start = max_start;
> > +
> > +       return max_cnt;
> > +}

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ