From patchwork Wed Aug 4 04:19:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 60820 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 782DB100A16 for ; Wed, 4 Aug 2010 14:19:57 +1000 (EST) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B0CB1007D1 for ; Wed, 4 Aug 2010 14:19:49 +1000 (EST) Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id o744JVkf023187; Tue, 3 Aug 2010 23:19:32 -0500 Subject: [PATCH] memblock: Fix memblock_is_region_reserved() to return a boolean From: Benjamin Herrenschmidt To: "linux-kernel@vger.kernel.org" Date: Wed, 04 Aug 2010 14:19:31 +1000 Message-ID: <1280895571.1902.140.camel@pasglop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Cc: Russell King , linuxppc-dev , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org 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. Signed-off-by: Benjamin Herrenschmidt --- 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. diff --git a/mm/memblock.c b/mm/memblock.c index 3024eb3..43840b3 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -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; } /*