Re: [PATCH 3/3] resource: Fix find_next_iomem_res() iteration issue

From: Baoquan He
Date: Tue Sep 25 2018 - 04:58:54 EST


Hi Bjorn,

On 09/24/18 at 05:15pm, Bjorn Helgaas wrote:
> @@ -359,32 +362,31 @@ static int find_next_iomem_res(struct resource *res, unsigned long desc,
> read_unlock(&resource_lock);
> if (!p)
> return -1;
> +
> /* copy data */
> - if (res->start < p->start)
> - res->start = p->start;
> - if (res->end > p->end)
> - res->end = p->end;
> + res->start = max(start, p->start);
> + res->end = min(end, p->end);
> res->flags = p->flags;

I think this fix is good. However, is it OK to keep res->flags always,
never touch it in find_next_iomem_res()? We just iterate and update
region, its start and end. So just removing that "res->flags = p->flags;"
line might involve much less code changes.

Thanks
Baoquan