Skip to content

Commit 303e6da

Browse files
Wei Yongjunbrgl
authored andcommitted
gpio: mockup: remove gpio debugfs when remove device
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. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent 3f4e432 commit 303e6da

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/gpio/gpio-mockup.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
373373
}
374374
}
375375

376+
static void gpio_mockup_debugfs_cleanup(void *data)
377+
{
378+
struct gpio_mockup_chip *chip = data;
379+
380+
debugfs_remove_recursive(chip->dbg_dir);
381+
}
382+
376383
static void gpio_mockup_dispose_mappings(void *data)
377384
{
378385
struct gpio_mockup_chip *chip = data;
@@ -455,7 +462,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
455462

456463
gpio_mockup_debugfs_setup(dev, chip);
457464

458-
return 0;
465+
return devm_add_action_or_reset(dev, gpio_mockup_debugfs_cleanup, chip);
459466
}
460467

461468
static const struct of_device_id gpio_mockup_of_match[] = {

0 commit comments

Comments
 (0)