> > -static void __init efi_clean_memmap(void)
> > +void __init efi_clean_memmap(void)
> > {
> > - efi_memory_desc_t *out = efi.memmap.map;
> > - const efi_memory_desc_t *in = out;
> > - const efi_memory_desc_t *end = efi.memmap.map_end;
> > - int i, n_removal;
> > -
> > - for (i = n_removal = 0; in < end; i++) {
> > - if (efi_memmap_entry_valid(in, i)) {
> > - if (out != in)
> > - memcpy(out, in, efi.memmap.desc_size);
> > - out = (void *)out + efi.memmap.desc_size;
> > - } else {
> > + void *out;
> > + efi_memory_desc_t *md;
> > + unsigned int i = 0, n_removal = 0;
>
> Perhaps we can use 'unsigned int i = n_removal = 0;', which appears more
> readable.
Hmm.. that actually throws an compilation error saying that "n_removal is
undeclared".
So, let's stick with unsigned int i = 0, n_removal = 0;
>
> > + struct efi_memory_map new_memmap;
> > +
> > + for_each_efi_memory_desc(md) {
> > + if (!efi_memmap_entry_valid(md, i))
> > n_removal++;
> > - }
> > - in = (void *)in + efi.memmap.desc_size;
> > }
> >
> > - if (n_removal > 0) {
> > - u64 size = efi.memmap.nr_map - n_removal;
> > + if (n_removal == 0)
>
> and 'if (!n_removal)' above, to stay in sync with the rest of the code in
> this file.
Sure! Thanks for the catch. I will fix it.
Regards,
Sai