diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-09-20 16:30:31 +0300 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2022-09-20 17:07:15 +0300 |
commit | 02743c4091ccfb246f5cdbbe3f44b152d5d12933 (patch) | |
tree | cd5c6b0a4d074f741e07153419cd4e737a892266 /drivers/gpio/gpio-mockup.c | |
parent | b7df41a6f79dfb18ba2203f8c5f0e9c0b9b57f68 (diff) | |
download | linux-02743c4091ccfb246f5cdbbe3f44b152d5d12933.tar.xz |
gpio: mockup: Fix potential resource leakage when register a chip
If creation of software node fails, the locally allocated string
array is left unfreed. Free it on error path.
Fixes: 6fda593f3082 ("gpio: mockup: Convert to use software nodes")
Cc: stable@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio/gpio-mockup.c')
-rw-r--r-- | drivers/gpio/gpio-mockup.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index ab89cd8ddbd8..523dfd17dd92 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -533,8 +533,10 @@ static int __init gpio_mockup_register_chip(int idx) } fwnode = fwnode_create_software_node(properties, NULL); - if (IS_ERR(fwnode)) + if (IS_ERR(fwnode)) { + kfree_strarray(line_names, ngpio); return PTR_ERR(fwnode); + } pdevinfo.name = "gpio-mockup"; pdevinfo.id = idx; |