From patchwork Thu Nov 24 14:02:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 83981 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp208685qgi; Thu, 24 Nov 2016 10:51:11 -0800 (PST) X-Received: by 10.195.11.229 with SMTP id el5mr4220377wjd.64.1480013471248; Thu, 24 Nov 2016 10:51:11 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id qq8si38223499wjc.143.2016.11.24.10.51.10; Thu, 24 Nov 2016 10:51:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3BE384BDBD; Thu, 24 Nov 2016 19:51:10 +0100 (CET) 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 2tqmC2Iy5wVP; Thu, 24 Nov 2016 19:51:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AF7894BA16; Thu, 24 Nov 2016 19:51:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6534D4BA16 for ; Thu, 24 Nov 2016 19:51:06 +0100 (CET) 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 3_-mFUjdvbJJ for ; Thu, 24 Nov 2016 19:51:06 +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 mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by theia.denx.de (Postfix) with ESMTPS id 389AF4A01C for ; Thu, 24 Nov 2016 19:51:02 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id a197so123120917wmd.0 for ; Thu, 24 Nov 2016 10:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=5NqpnehipJzRucq5WZay81ATwqVZdPkZNfjCVj7vIIY=; b=zDqZgwaXuABcGDCmmHfsXrRYJAM+QLPLWHoTkTYB2vItmB7+CI4A0/HIAgu6SkHs3i apCxdFLC75w+JCIdgYIedPosOcEZheVoHI2AnXQMbNUBShxnv17QfFxMh2viI5/AC8M0 Tl3K+P1UMlSKPbg4Ov2GIWiXvjzbu0gVF5yUK6bxI/oZzokj8jHKjgEuim8pgaWCv79n VpDRFS79ImNHBqOBrBG7lnI3rDCgfI7TccoLx305LXsHNFFNx3UTtNn+XC3riEq1l4FV amPooJx5n9Vh6tU+RIji2hBc39tCy6oVJi6gJv+dVIVvJSUeCYNe6tIiSFvYxmoAede/ ZW4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5NqpnehipJzRucq5WZay81ATwqVZdPkZNfjCVj7vIIY=; b=XUjKR26Jt2RBruXTamdG1Hi7NvVxyIEGPSKO7xhog92S2OwukqcKsfSrvV4F6EH1CR gr2wsKcZdrA76oZtqs/ATh3w1z3x95fWAmTBm9NHv+42IpqaioEBTdguU8I/eZHdjWiJ 8yS1S1CH9oIzgUnownWKQxV1JK1wql6Tcls6BJe/EX/m0vBBG1/LhyZ7u9ZXtdDPa7HM ksxSNMLhxb2s4deLkOsbrUtuCMxfwp9n/2VHtizPSCiYsRhjxGT030WAT4YPHnHUtp0N 77IEUKw5bvhTF7erh1PDOu2ruLnDIri/OSnf6inwi/jmmB3CIsIz6z1jDoJZ3rMvKplw vzYg== X-Gm-Message-State: AKaTC025e2N0s9vH0H3Q2WwxKk3Qoo/GxMBDmdDAR8LADlfniy04sk5BJjD1jGX4zgAjp5ka X-Received: by 10.28.218.213 with SMTP id r204mr2560104wmg.69.1479996149525; Thu, 24 Nov 2016 06:02:29 -0800 (PST) Received: from localhost.localdomain (cag06-8-78-203-165-84.fbx.proxad.net. [78.203.165.84]) by smtp.gmail.com with ESMTPSA id 81sm8393685wmw.7.2016.11.24.06.02.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 06:02:28 -0800 (PST) From: Fabien Parent To: u-boot@lists.denx.de Date: Thu, 24 Nov 2016 15:02:18 +0100 Message-Id: <20161124140218.1270-1-fparent@baylibre.com> X-Mailer: git-send-email 2.10.2 Subject: [U-Boot] [PATCH] cmd/fdt: fix uncallable systemsetup command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The function that is processing the 'fdt' parameters is one big if-else if. In order to be able to type command faster only the first few letter are checked to know which block of code to execute. For systemsetup, the block of code that was executed was always the wrong one and ended up in a failure. } else if (argv[1][0] == 's') { process "fdt set" command } else if (strncmp(argv[1], "sys", 3) == 0) { process "fdt systemsetup" command. } When typing "fdt systemsetup", the code that was executed was the code for "fdt set". This commit fix this issue by moving the "else if" for systemsetup before the else if for "fdt set". This allow us to keep compatibility with any script that make use of "fdt s" to set node values. Signed-off-by: Fabien Parent --- cmd/fdt.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.10.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot Acked-by: Simon Glass diff --git a/cmd/fdt.c b/cmd/fdt.c index b503357..8bd345a 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -206,7 +206,17 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } working_fdt = newaddr; +#ifdef CONFIG_OF_SYSTEM_SETUP + /* Call the board-specific fixup routine */ + } else if (strncmp(argv[1], "sys", 3) == 0) { + int err = ft_system_setup(working_fdt, gd->bd); + if (err) { + printf("Failed to add system information to FDT: %s\n", + fdt_strerror(err)); + return CMD_RET_FAILURE; + } +#endif /* * Make a new node */ @@ -577,18 +587,6 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } } #endif -#ifdef CONFIG_OF_SYSTEM_SETUP - /* Call the board-specific fixup routine */ - else if (strncmp(argv[1], "sys", 3) == 0) { - int err = ft_system_setup(working_fdt, gd->bd); - - if (err) { - printf("Failed to add system information to FDT: %s\n", - fdt_strerror(err)); - return CMD_RET_FAILURE; - } - } -#endif /* Create a chosen node */ else if (strncmp(argv[1], "cho", 3) == 0) { unsigned long initrd_start = 0, initrd_end = 0;