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: <ZM1YW025tD6S/y+Q@smile.fi.intel.com>
Date:   Fri, 4 Aug 2023 22:58:19 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Kent Gibson <warthog618@...il.com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [RFC PATCH] gpio: consumer: new virtual driver

On Fri, Aug 04, 2023 at 06:03:47PM +0200, Bartosz Golaszewski wrote:
> On Thu, Aug 3, 2023 at 1:39 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:

...

> > > +     if (list_empty(&dev->lookup_list))
> > > +             return -ENODATA;
> >
> > Instead you may count nodes here and if 0, return an error, otherwise pass it
> > to the callee.
> 
> I'm not following, please rephrase.

The below call calls list_count_nodes(), you may simply join these two checks
by calling list_count_nodes() and return -ENODATA in case it's 0.

> > > +     swnode = gpio_consumer_make_device_swnode(dev);
> > > +     if (IS_ERR(swnode))
> > > +             return PTR_ERR(swnode);

...

> > > +     if ((!live && !gpio_consumer_device_is_live_unlocked(dev)) ||
> > > +         (live && gpio_consumer_device_is_live_unlocked(dev)))
> >
> >         if (live ^ gpio_consumer_device_is_live_unlocked(dev))
> >
> > ?
> 
> Nah, let's not use bitwise operators for boolean logic.

Then it's even simpler:

	if (live == gpio_consumer_device_is_live_unlocked(dev))

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ