From patchwork Fri Oct 8 12:41:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 67189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CBFEDB70A7 for ; Fri, 8 Oct 2010 23:43:55 +1100 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1P4CGb-0006yu-H5; Fri, 08 Oct 2010 12:41:41 +0000 Received: from localhost ([127.0.0.1] helo=localhost.localdomain) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P4CGZ-0003Iy-HU; Fri, 08 Oct 2010 12:41:39 +0000 Received: from mo-p05-ob.rzone.de ([81.169.146.180]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1P4CGV-0003IY-Ob for linux-mtd@lists.infradead.org; Fri, 08 Oct 2010 12:41:37 +0000 X-RZG-AUTH: :IW0NeWC7b/q2i6W/qstXb1SBUuFnrGohavlCkce+Ub5QXMSOpHp3KJg5KrxoMw== X-RZG-CLASS-ID: mo05 Received: from quad.fritz.box (p57BD4AAE.dip.t-dialin.net [87.189.74.174]) by post.strato.de (mrclete mo37) (RZmta 23.5) with ESMTP id 403186m98BA59L for ; Fri, 8 Oct 2010 14:41:29 +0200 (MEST) From: Stefan Roese To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: physmap_of: Loop through all "reg" tuples for mapping Date: Fri, 8 Oct 2010 14:41:27 +0200 Message-Id: <1286541687-5706-1-git-send-email-sr@denx.de> X-Mailer: git-send-email 1.7.3.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101008_084136_013196_E9A9D98A X-CRM114-Status: GOOD ( 12.07 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [81.169.146.180 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch changes the loop over the "reg" tuples to not exit directly upon of_address_to_resource() failure but to continue with the next "reg" tuple instead. This failure could be due to size = 0, which might be passed via the device-tree. This is needed for boards, where a "reg" tuple might have size 0 (of_address_to_resource() returns with EINVAL when size = 0). Example: Fully equipped board: reg = <0 0x00000000 0x00400000 0 0x00400000 0x00400000>; Partially equipped board: reg = <0 0x00000000 0x00400000 0 0x00400000 0x00000000>; This could be the case on boards with runtime detection of multiple NOR flash configurations where the detected flash size is inserted into the dtb in U-Boot. Signed-off-by: Stefan Roese --- drivers/mtd/maps/physmap_of.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index fe63f6b..6967348 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -267,9 +267,11 @@ static int __devinit of_flash_probe(struct platform_device *dev, for (i = 0; i < count; i++) { err = -ENXIO; if (of_address_to_resource(dp, i, &res)) { - dev_err(&dev->dev, "Can't get IO address from device" - " tree\n"); - goto err_out; + /* + * Continue with next register tuple if this + * one is not mappable + */ + continue; } dev_dbg(&dev->dev, "of_flash device: %.8llx-%.8llx\n",