[PATCH] pinctrl: single: Add missing free in single_allocate_function
Quentin Schulz
quentin.schulz at cherry.de
Wed Dec 3 16:36:49 CET 2025
Hi François,
On 12/2/25 7:39 PM, Francois Berder wrote:
> If func->pins could not be allocated, one must also free
> func variable that was allocated previously.
>
Well.... devm_* functions should take care of this when the device is
removed (or probe failed), but if and only if CONFIG_DEVRES is enabled.
However, in that case, this code may be executed outside of a probe
scenario I guess (it is called in set_state() callback from the pinctrl
device). This thus makes sense to me here.
Reviewed-by: Quentin Schulz <quentin.schulz at cherry.de>
I'm also wondering if we shouldn't check the return value of
single_configure_pins/bits in set_state instead of always returning 0?
We probably need to devm_kfree a bunch of other devm_ allocations as well?
I see a loop in single_add_gpio_func() we should probably unwind if
there's a devm_kzalloc which fails?
Maybe we need a .remove callback where we devm_kfree all of functions
and gpiofuncs lists from single_priv, in case DEVRES isn't actually set?
Cheers,
Quentin
More information about the U-Boot
mailing list