pinctrl: single: Add missing free in single_allocate_function

If func->pins could not be allocated, one must also free
func variable that was allocated previously.

Signed-off-by: Francois Berder <fberder@outlook.fr>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This commit is contained in:
Francois Berder
2025-12-02 19:39:39 +01:00
committed by Tom Rini
parent 87c0e413eb
commit eb52d3fe8a

View File

@@ -282,8 +282,10 @@ static struct single_func *single_allocate_function(struct udevice *dev,
func->pins = devm_kmalloc(dev, sizeof(unsigned int) * group_pins,
GFP_KERNEL);
if (!func->pins)
if (!func->pins) {
devm_kfree(dev, func);
return ERR_PTR(-ENOMEM);
}
return func;
}