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: <CAMRc=McG5Pf4b5HymV1iaFAGqMMEtyYSQi23z9LmjvzmbF4rYg@mail.gmail.com>
Date:   Fri, 19 Aug 2022 14:49:42 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Wei Yongjun <weiyongjun1@...wei.com>
Cc:     Bamvor Jian Zhang <bamv2005@...il.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] gpio: mockup: remove gpio debugfs when remove device

On Tue, Aug 16, 2022 at 4:34 PM Wei Yongjun <weiyongjun1@...wei.com> wrote:
>
> GPIO mockup debugfs is created in gpio_mockup_probe() but
> forgot to remove when remove device. This patch add a devm
> managed callback for removing them.
>

The tag -next is for patches that address issues that are in next but
not yet in master.

> Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
> ---
>  drivers/gpio/gpio-mockup.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index 8943cea92764..1fdc444b093b 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -373,6 +373,13 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
>         }
>  }
>
> +static void gpio_mockup_debugfs_cleanup(void *data)
> +{
> +       struct gpio_mockup_chip *chip = data;
> +
> +       debugfs_remove_recursive(chip->dbg_dir);
> +}
> +
>  static void gpio_mockup_dispose_mappings(void *data)
>  {
>         struct gpio_mockup_chip *chip = data;
> @@ -455,6 +462,10 @@ static int gpio_mockup_probe(struct platform_device *pdev)
>
>         gpio_mockup_debugfs_setup(dev, chip);
>
> +       rv = devm_add_action_or_reset(dev, gpio_mockup_debugfs_cleanup, chip);
> +       if (rv)
> +               return rv;
> +

Please return that function directly.

>         return 0;
>  }
>
> --
> 2.34.1
>

This isn't very relevant as the module needs to be unloaded anyway in
order to reconfigure the simulated device but I'll apply it as it's
technically correct. Did you see we have a new one - gpio-sim - that
uses configfs?

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ