From patchwork Thu Nov 28 09:51:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: miao.yan@windriver.com X-Patchwork-Id: 294840 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 56C1C2C008E for ; Thu, 28 Nov 2013 20:52:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9CCC4BE62; Thu, 28 Nov 2013 10:52:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nrV2BKVQxJqC; Thu, 28 Nov 2013 10:52:33 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 505D74BE75; Thu, 28 Nov 2013 10:52:14 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2A8B34BE53 for ; Thu, 28 Nov 2013 10:52:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 224f0HdGAZrB for ; Thu, 28 Nov 2013 10:51:56 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by theia.denx.de (Postfix) with ESMTPS id C4AD84BE43 for ; Thu, 28 Nov 2013 10:51:48 +0100 (CET) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.14.5/8.14.5) with ESMTP id rAS9plvH017540 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Thu, 28 Nov 2013 01:51:47 -0800 (PST) Received: from myan-OptiPlex-9010.corp.ad.wrs.com (128.224.162.147) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Nov 2013 01:51:46 -0800 From: myan To: Date: Thu, 28 Nov 2013 17:51:39 +0800 Message-ID: <1385632300-23206-4-git-send-email-miao.yan@windriver.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1385632300-23206-1-git-send-email-miao.yan@windriver.com> References: <1379417643-6106-2-git-send-email-miao.yan@windriver.com> <1385632300-23206-1-git-send-email-miao.yan@windriver.com> MIME-Version: 1.0 X-Originating-IP: [128.224.162.147] Subject: [U-Boot] [PATCH v3 4/5] common/fdt_support.c: avoid unintended return from fdt_fixup_memory_banks() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Miao Yan fdt_fixup_memory_banks() will add and update /memory node in device tree blob. In the case that /memory node doesn't exist, after adding a new one, this function returns error. The correct behavior should be continuing to update its properties. Signed-off-by: Miao Yan --- changes: v2->v3: rebase to master: d19ad726bcd5d9106f7ba9c750462fcc369f1020 v1->v2: none common/fdt_support.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index 1f0d8f5..4e32b02 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -400,10 +400,11 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks) nodeoffset = fdt_path_offset(blob, "/memory"); if (nodeoffset < 0) { nodeoffset = fdt_add_subnode(blob, 0, "memory"); - if (nodeoffset < 0) + if (nodeoffset < 0) { printf("WARNING: could not create /memory: %s.\n", fdt_strerror(nodeoffset)); - return nodeoffset; + return nodeoffset; + } } err = fdt_setprop(blob, nodeoffset, "device_type", "memory", sizeof("memory"));