From patchwork Mon Aug 1 12:31:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Iles X-Patchwork-Id: 1025952 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p71CXKQk007654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 1 Aug 2011 12:33:41 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qnrg7-0004DZ-3t; Mon, 01 Aug 2011 12:33:03 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qnrfw-0002VP-Jv; Mon, 01 Aug 2011 12:32:52 +0000 Received: from mail-wy0-f177.google.com ([74.125.82.177]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qnreb-00023O-2p for linux-arm-kernel@lists.infradead.org; Mon, 01 Aug 2011 12:31:30 +0000 Received: by mail-wy0-f177.google.com with SMTP id 23so1530697wyf.36 for ; Mon, 01 Aug 2011 05:31:28 -0700 (PDT) Received: by 10.227.201.10 with SMTP id ey10mr1022969wbb.103.1312201887811; Mon, 01 Aug 2011 05:31:27 -0700 (PDT) Received: from localhost (gw-ba1.picochip.com [94.175.234.108]) by mx.google.com with ESMTPS id fo2sm4137778wbb.48.2011.08.01.05.31.26 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Aug 2011 05:31:27 -0700 (PDT) From: Jamie Iles To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/9] orion: make __arch_ioremap() with 0 size return NULL Date: Mon, 1 Aug 2011 13:31:07 +0100 Message-Id: <1312201870-12921-6-git-send-email-jamie@jamieiles.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1312201870-12921-1-git-send-email-jamie@jamieiles.com> References: <1312201870-12921-1-git-send-email-jamie@jamieiles.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110801_083129_372572_E8886695 X-CRM114-Status: GOOD ( 13.26 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] Cc: Jamie Iles , Lennert Buytenhek X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 01 Aug 2011 12:33:41 +0000 (UTC) Without __arch_ioremap(), __get_vm_area_node() with a zero size will return a NULL pointer. Make the arch specific ioremap() do the same thing. Cc: Lennert Buytenhek Signed-off-by: Jamie Iles --- arch/arm/mach-orion5x/include/mach/io.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h index c519610..8763328 100644 --- a/arch/arm/mach-orion5x/include/mach/io.h +++ b/arch/arm/mach-orion5x/include/mach/io.h @@ -20,6 +20,10 @@ __arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype) { void __iomem *retval; unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE; + + if (!size) + return NULL; + if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE && size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) { retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;