diff options
Diffstat (limited to 'src/lib/memrange.c')
-rw-r--r-- | src/lib/memrange.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/memrange.c b/src/lib/memrange.c index a85bc01d49..d2ffa26e99 100644 --- a/src/lib/memrange.c +++ b/src/lib/memrange.c @@ -228,6 +228,9 @@ static void do_action(struct memranges *ranges, resource_t end; resource_t begin; + if (size == 0) + return; + /* The addresses are aligned to 4096 bytes: the begin address is * aligned down while the end address is aligned up to be conservative * about the full range covered. */ @@ -290,11 +293,16 @@ void memranges_add_resources(struct memranges *ranges, memranges_add_resources_filter(ranges, mask, match, tag, NULL); } +void memranges_init_empty(struct memranges *ranges) +{ + ranges->entries = NULL; +} + void memranges_init(struct memranges *ranges, unsigned long mask, unsigned long match, unsigned long tag) { - ranges->entries = NULL; + memranges_init_empty(ranges); memranges_add_resources(ranges, mask, match, tag); } |