diff options
author | Martin Schwan <m.schwan@phytec.de> | 2025-08-13 13:54:07 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-08-21 15:05:04 -0600 |
commit | 302830499d9f0ebec42fe62254429a4d8db6b36c (patch) | |
tree | 0a82b4f89657964895e4624c5980b3e3f433e56e | |
parent | b389967f9a624b35c163767c34919cbdcd4e0917 (diff) |
bootstd: rauc: Move freeing private struct to its own function
Move freeing a distro_rauc_priv struct to a new, separate function for
better reuse.
Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
-rw-r--r-- | boot/bootmeth_rauc.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/boot/bootmeth_rauc.c b/boot/bootmeth_rauc.c index c8efdce75b9..f781a7fc0b5 100644 --- a/boot/bootmeth_rauc.c +++ b/boot/bootmeth_rauc.c @@ -52,6 +52,18 @@ struct distro_rauc_priv { struct distro_rauc_slot **slots; }; +static void distro_rauc_priv_free(struct distro_rauc_priv *priv) +{ + int i; + + for (i = 0; priv->slots[i]; i++) { + free(priv->slots[i]->name); + free(priv->slots[i]); + } + free(priv->slots); + free(priv); +} + static struct distro_rauc_slot *get_slot(struct distro_rauc_priv *priv, const char *slot_name) { @@ -187,11 +199,7 @@ static int distro_rauc_read_bootflow(struct udevice *dev, struct bootflow *bflow ret = distro_rauc_scan_parts(bflow); if (ret < 0) { - for (i = 0; priv->slots[i]; i++) { - free(priv->slots[i]->name); - free(priv->slots[i]); - } - free(priv); + distro_rauc_priv_free(priv); free(boot_order_copy); return ret; } |