On Tue, 11 Mar 2025 at 19:13, Ilias Apalodimas
<[email protected]> wrote:
>
> Hi Sughosh,
>
> [...]
>
> >  {
> > -       unsigned long fdt_pages;
> >         efi_status_t ret = 0;
> >         void *fdt, *new_fdt;
> > -       u64 new_fdt_addr;
> > -       uint fdt_size;
> > +       static u64 new_fdt_addr;
> > +       static ulong fdt_pages;
>
> efi_uintn_t fdt_pages

Okay

>
> > +       ulong fdt_size;
> > +
> > +       if ((new_fdt_addr && !fdt_pages) || (fdt_pages && !new_fdt_addr)) {
>
> Is there a case when this can happen? I think we can just get rid of it 
> entirely

Yeah, I was just trying to be defensive here. But it can be removed,
since these values are not coming from a separate caller.

-sughosh

>
> > +               log_err("%s: Fdt address/size not in the right state\n",
> > +                       __func__);
> > +               return EFI_INVALID_PARAMETER;
> > +       }
> > +
> > +       if (new_fdt_addr) {
> > +               log_debug("%s: Found allocated memory at %#llx, with %#lx 
> > pages\n",
> > +                       __func__, new_fdt_addr, fdt_pages);
> > +               ret = efi_free_pages(new_fdt_addr, fdt_pages);
> > +               if (ret != EFI_SUCCESS) {
> > +                       log_err("Unable to free up existing FDT memory 
> > region\n");
> > +                       return ret;
> > +               }
> > +       }
> >
> >         /*
> [...]
>
> Chers
> /Ilias

Reply via email to