Hi Nikita,

On 2026-09-02T06:31:15, Nikita Shubin <[email protected]> wrote:
> common: spl: ram: Add LOAD_FIT_FULL support
>
> The simple FIT loader lacks support for full image verification
> (CONFIG_SPL_FIT_FULL_CHECK). The full parser (spl_load_fit_image)
> provides this feature.
>
> Enable it when CONFIG_SPL_LOAD_FIT_FULL is selected. If the full load
> fails, fall back to the simple loader to preserve compatibility.
>
> Signed-off-by: Nikita Shubin <[email protected]>
>
>  common/spl/spl_ram.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)

> diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
> @@ -81,11 +81,22 @@ static int spl_ram_load_image(struct spl_image_info 
> *spl_image,
>               debug("Found FIT\n");
> -             spl_load_init(&load, spl_ram_load_read, NULL, 1);
> -             ret = spl_load_simple_fit(spl_image, &load, 0, header);
> +             /* by default, assume failure and fall back to simple FIT */
> +             int ret = -1;

This 'ret' shadows the one declared at the top of
spl_ram_load_image(). Its value is lost when the block ends, so the
final 'return ret' returns the outer variable instead. That one is
uninitialised, or 0 if IMAGE_PRE_LOAD is enabled, so a FIT which fails
with both loaders may still be reported as a success. It also puts a
declaration after a statement. Please can you drop the local and use
the outer 'ret', e.g.:

    if (CONFIG_IS_ENABLED(LOAD_FIT_FULL)) {
        ret = spl_load_fit_image(spl_image, header);
        if (!ret)
            return 0;
        debug("Loading FULL FIT failed, trying SIMPLE FIT\n");
    }
    spl_load_init(&load, spl_ram_load_read, NULL, 1);
    ret = spl_load_simple_fit(spl_image, &load, 0, header);

Regards,
Simon

Reply via email to