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: <CACRpkdavsv3nJnhtdqW8ANAVfxbgHdM-SpcfOv4p_t-7EOaOHQ@mail.gmail.com>
Date:   Tue, 15 Aug 2023 10:04:32 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Bartosz Golaszewski <brgl@...ev.pl>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Kent Gibson <warthog618@...il.com>, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 2/2] gpio: sim: simplify code with cleanup helpers

On Wed, Aug 9, 2023 at 3:14 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> Use macros defined in linux/cleanup.h to automate resource lifetime
> control in the gpio-simulator.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
(...)
> -       mutex_lock(&chip->lock);
> +       guard(mutex)(&chip->lock);
(...)
> -       mutex_lock(&chip->lock);
> -       ret = !!test_bit(offset, chip->value_map);
> -       mutex_unlock(&chip->lock);
> +       scoped_guard(mutex, &chip->lock)
> +               ret = !!test_bit(offset, chip->value_map);

This is really neat. When I grep:ed around in linux-next this seemed like
the first user of the scoped guards, so maybe Peter Z want to take a look?
I bet there is other code using it coming for this next merge window as
well, but this is really the first that will land in linux-next as it seems.

It looks good to me FWIW:
Acked-by: Linus Walleij <linus.walleij@...aro.org>

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ