[PATCH 03/14] resource: add walk_system_ram_res_rev()

AKASHI Takahiro takahiro.akashi at linaro.org
Thu Aug 24 17:50:07 PDT 2017


On Thu, Aug 24, 2017 at 10:06:28AM +0100, Ard Biesheuvel wrote:
> On 24 August 2017 at 09:18, AKASHI Takahiro <takahiro.akashi at linaro.org> wrote:
> > +       /* create a list */
> > +       rams = vmalloc(sizeof(struct resource) * count);
> > +       if (!rams)
> > +               return ret;
> > +
> > +       res.start = start;
> > +       res.end = end;
> > +       res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > +       orig_end = res.end;
> > +       i = 0;
> > +       while ((res.start < res.end) &&
> > +               (!find_next_iomem_res(&res, IORES_DESC_NONE, true))) {
> > +               if (i >= count) {
> > +                       /* unlikely but */
> > +                       vfree(rams);
> > +                       count += 16;
> 
> If the count is likely to be < 16, why are we using vmalloc() here?

Ah, you're right :)

-Takahiro AKASHI



More information about the linux-arm-kernel mailing list