gpio: mockup: fix resource leak in error path
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 8 Sep 2020 13:07:49 +0000 (15:07 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 30 Sep 2020 08:50:25 +0000 (10:50 +0200)
commite0ab949f152a7f070fbf7b56d9caa4206b140190
tree54f7786a931269a31aa539cfa522d728cc99383f
parent12d16b397ce0a999d13762c4c0cae2fb82eb60ee
gpio: mockup: fix resource leak in error path

If the module init function fails after creating the debugs directory,
it's never removed. Add proper cleanup calls to avoid this resource
leak.

Fixes: 9202ba2397d1 ("gpio: mockup: implement event injecting over debugfs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpio-mockup.c