pinctrl: tegra: xusb: free maps on DT map failure

tegra_xusb_padctl_parse_subnode() can append mappings before a later
child or configuration operation fails.  The top-level callback currently
returns the error while retaining all mappings allocated for earlier
children.

Free the accumulated map on failure.  The caller ignores the output
parameters when the mapping callback returns an error, so they do not need
to be reset after freeing the map.

Signed-off-by: Jiale Yao <yaojiale02@163.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
Jiale Yao 2026-10-03 16:31:56 +08:00 committed by Linus Walleij
parent e873c665e5
commit efd9330bb6

View File

@ -248,10 +248,14 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl,
&reserved_maps,
num_maps);
if (err < 0)
return err;
goto err_free_map;
}
return 0;
err_free_map:
pinctrl_utils_free_map(pinctrl, *maps, *num_maps);
return err;
}
static const struct pinctrl_ops tegra_xusb_padctl_pinctrl_ops = {