Skip to contentSkip to conversation

memblock: Fix memblock_is_region_reserved() to return a boolean

PATCH New Benjamin Herrenschmidt 1 participant 1 message Aug 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memblock: Fix memblock_is_region_reserved() to return a boolean

All callers expect a boolean result which is true if the region overlaps a reserved region. However, the implementation actually returns -1 if there is no overlap, and a region index (0 based) if there is.

Make it behave as callers (and common sense) expect.

---

Taking that out of my memblock rework branch as it should go in now regardless of whether my stuff goes or not (which is still under discussion, I'm fixing ARM up now).

I'll send this fix to Linus tomorrow along with powerpc.git if there is no adverse comment.

mm/memblock.c +1 -1
index 3024eb3..43840b3 100644
@@ -504,7 +504,7 @@ int __init memblock_is_reserved(u64 addr)
 
 int memblock_is_region_reserved(u64 base, u64 size)
 {
-	return memblock_overlaps_region(&memblock.reserved, base, size);
+	return memblock_overlaps_region(&memblock.reserved, base, size) >= 0;
 }
 
 /*