mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 09:01:34 +00:00
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: 6fda593f30
("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>
This commit is contained in:
parent
b7df41a6f7
commit
02743c4091
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user