From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBA42C05027 for ; Fri, 10 Feb 2023 11:34:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D43A78575C; Fri, 10 Feb 2023 12:34:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=KARO-electronics.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id F04948584F; Fri, 10 Feb 2023 12:34:10 +0100 (CET) Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.18.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 56C4E8573A for ; Fri, 10 Feb 2023 12:34:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=KARO-electronics.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=LW@KARO-electronics.de Received: from [89.1.81.74] (helo=karo-electronics.de) by smtprelay04.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pQRfL-0001jr-R9; Fri, 10 Feb 2023 12:34:07 +0100 Date: Fri, 10 Feb 2023 12:34:06 +0100 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= To: Andre Przywara Cc: Simon Glass , Tom Rini , Heinrich Schuchardt , u-boot@lists.denx.de Subject: Re: [PATCH v2 2/3] cmd: fdt: allow standalone "fdt move" Message-ID: <20230210123406.329cb264@karo-electronics.de> In-Reply-To: <20230210110213.2531190-3-andre.przywara@arm.com> References: <20230210110213.2531190-1-andre.przywara@arm.com> <20230210110213.2531190-3-andre.przywara@arm.com> Organization: Ka-Ro electronics GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kb21haW5mYWN0b3J5LWt1bmRlLmRl X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi, On Fri, 10 Feb 2023 11:02:12 +0000 Andre Przywara wrote: > At the moment every subcommand of "fdt", except "addr" itself, requires > the DT address to be set first. We explicitly check for that before even > comparing against the subcommands' string. > This early bailout also affects the "move" subcommand, even though that > does not require or rely on a previous call to "fdt addr". In fact it > even sets the FDT address to the target of the move command, so is a > perfect beginning for a sequence of fdt commands. >=20 > Move the check for a previously set FDT address to after we handle the > "move" command also, so we don't need a dummy call to "fdt addr" first, > before being able to move the devicetree. >=20 > This skips one pointless "fdt addr" call in scripts which aim to alter > the control DT, but need to copy it to a safe location first (for > instance to $fdt_addr_r). >=20 > Signed-off-by: Andre Przywara > Reviewed-by: Simon Glass > --- > cmd/fdt.c | 28 +++++++++++++++++----------- > 1 file changed, 17 insertions(+), 11 deletions(-) >=20 > diff --git a/cmd/fdt.c b/cmd/fdt.c > index 0ba691c573b..1972490bdc2 100644 > --- a/cmd/fdt.c > +++ b/cmd/fdt.c > @@ -208,19 +208,11 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, = int argc, char *const argv[]) > } > =20 > return CMD_RET_SUCCESS; > - } > - > - if (!working_fdt) { > - puts("No FDT memory address configured. Please configure\n" > - "the FDT address via \"fdt addr
\" command.\n" > - "Aborting!\n"); > - return CMD_RET_FAILURE; > - } > =20 > /* > * Move the working_fdt > */ > - if (strncmp(argv[1], "mo", 2) =3D=3D 0) { > + } else if (strncmp(argv[1], "mo", 2) =3D=3D 0) { > struct fdt_header *newaddr; > int len; > int err; > @@ -263,9 +255,20 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, i= nt argc, char *const argv[]) > return 1; > } It's not part of your changes, but this should rather be: return CMD_RET_FAILURE; Lothar Wa=C3=9Fmann