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] [day] [month] [year] [list]
Date:   Thu, 1 Jun 2023 10:00:35 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v1 1/2] gpiolib: Consolidate the allocated mask freeing APIs

On Sat, May 27, 2023 at 1:40 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> There is a common API to allocate a mask, but more than one duplicative
> counterparts. Consolidate the latter into a single common API beneath.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/gpio/gpiolib.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index e62db4fc85cc..6c8580d2454d 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -466,6 +466,12 @@ static unsigned long *gpiochip_allocate_mask(struct gpio_chip *gc)
>         return p;
>  }
>
> +static void gpiochip_free_mask(unsigned long **p)
> +{
> +       bitmap_free(*p);
> +       *p = NULL;
> +}
> +
>  static unsigned int gpiochip_count_reserved_ranges(struct gpio_chip *gc)
>  {
>         struct device *dev = &gc->gpiodev->dev;
> @@ -545,8 +551,7 @@ static int gpiochip_init_valid_mask(struct gpio_chip *gc)
>
>  static void gpiochip_free_valid_mask(struct gpio_chip *gc)
>  {
> -       bitmap_free(gc->valid_mask);
> -       gc->valid_mask = NULL;
> +       gpiochip_free_mask(&gc->valid_mask);
>  }
>
>  static int gpiochip_add_pin_ranges(struct gpio_chip *gc)
> @@ -1090,8 +1095,7 @@ static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gc)
>
>  static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gc)
>  {
> -       bitmap_free(gc->irq.valid_mask);
> -       gc->irq.valid_mask = NULL;
> +       gpiochip_free_mask(&gc->irq.valid_mask);
>  }
>
>  bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
> --
> 2.40.0.1.gaa8946217a0b
>

Both applied, thanks!

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ