[PATCH 2/3] cmd: ubi: allow creating volume with all free spaces in ubi_create_vol

Simon Glass sjg at chromium.org
Sat Apr 18 02:47:23 CEST 2026


Hi Weijie,

On 2026-04-17T02:35:14, Weijie Gao <weijie.gao at mediatek.com> wrote:
> cmd: ubi: allow creating volume with all free spaces in ubi_create_vol
>
> Although the ubi command itself supports creating volume with all
> free spaces, the api ubi_create_vol() does not.
>
> Since negative size in invalid, this patch replaces negative size

is invalid

> with all free space size in ubi_create_vol().
>
> Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
>
> cmd/ubi.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

> diff --git a/cmd/ubi.c b/cmd/ubi.c
> @@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
> +     if (size < 0)
> +             req.bytes = ubi->avail_pebs * ubi->leb_size;
> +     else
> +             req.bytes = size;

When size is negative, the printf() below still prints the original
negative size rather than the computed req.bytes

Regards,
Simon


More information about the U-Boot mailing list