diff mbox series

[4/5] fdt: Fix 'system' command

Message ID 1584387649-20959-5-git-send-email-twarren@nvidia.com
State Accepted
Commit 0688b758a2c2d3c56dd46ceb6c78ebf29867cc57
Headers show
Series Misc fixes for Tegra | expand

Commit Message

Tom Warren March 16, 2020, 7:40 p.m. UTC
From: Tom Warren <twarren at nvidia.com>

'fdt systemsetup' wasn't working, due to the fact that the 'set' command
was being parsed in do_fdt() by only testing for the leading 's' instead
of "se", which kept the "sys" test further down from executing. Changed
to test for "se" instead, now 'fdt systemsetup' works (to test the
ft_system_setup proc w/o having to boot a kernel).

Signed-off-by: Tom Warren <twarren at nvidia.com>
---
 cmd/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Warren March 17, 2020, 5:32 p.m. UTC | #1
On 3/16/20 1:40 PM, twarren at nvidia.com wrote:
> From: Tom Warren <twarren at nvidia.com>
> 
> 'fdt systemsetup' wasn't working, due to the fact that the 'set' command
> was being parsed in do_fdt() by only testing for the leading 's' instead
> of "se", which kept the "sys" test further down from executing. Changed
> to test for "se" instead, now 'fdt systemsetup' works (to test the
> ft_system_setup proc w/o having to boot a kernel).

Reviewed-by: Stephen Warren <swarren at nvidia.com>

(Although I wonder if this shouldn't just test the entire string to
avoid any possible future ambiguity if more sub-commands are added
later. Or doesn't U-Boot already have some sub-command table
infra-structure this could use?)
Tom Warren March 17, 2020, 5:46 p.m. UTC | #2
-----Original Message-----
From: Stephen Warren <swarren at wwwdotorg.org> 
Sent: Tuesday, March 17, 2020 10:33 AM
To: Tom Warren <TWarren at nvidia.com>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH 4/5] fdt: Fix 'system' command

External email: Use caution opening links or attachments


On 3/16/20 1:40 PM, twarren at nvidia.com wrote:
> From: Tom Warren <twarren at nvidia.com>
>
> 'fdt systemsetup' wasn't working, due to the fact that the 'set' 
> command was being parsed in do_fdt() by only testing for the leading 
> 's' instead of "se", which kept the "sys" test further down from 
> executing. Changed to test for "se" instead, now 'fdt systemsetup' 
> works (to test the ft_system_setup proc w/o having to boot a kernel).

Reviewed-by: Stephen Warren <swarren at nvidia.com>

(Although I wonder if this shouldn't just test the entire string to avoid any possible future ambiguity if more sub-commands are added later. Or doesn't U-Boot already have some sub-command table infra-structure this could use?)
[Tom] I usually take the path of least rework approach, so I just fixed the systemsetup command, which is what I was interested in. Let's see if any other Denxians chime in w/their opinion, and I can rework it if needed.


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
diff mbox series

Patch

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 25a6ed4..36cc726 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -286,7 +286,7 @@  static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	/*
 	 * Set the value of a property in the working_fdt.
 	 */
-	} else if (argv[1][0] == 's') {
+	} else if (strncmp(argv[1], "se", 2) == 0) {
 		char *pathp;		/* path */
 		char *prop;		/* property */
 		int  nodeoffset;	/* node offset from libfdt */