From 80b44fb3765e42e88e9cdd6cc037b47e3e263ff1 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Cortes Date: Mon, 18 Mar 2019 12:27:32 +0000 Subject: cmd: clk: Handle ENODEV from clk_get_rate clk_get_rate may return -ENODEV if the clock isn't valid. Also, make the error cases go through a single path. Fixes: ff8eee0330a6 ("cmd: clk: Add trivial implementation of clock dump for DM") Signed-off-by: Ismael Luceno Reviewed-by: Matthias Brugger Reviewed-by: Marek Vasut --- cmd/clk.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'cmd') diff --git a/cmd/clk.c b/cmd/clk.c index fd42315..5402c87 100644 --- a/cmd/clk.c +++ b/cmd/clk.c @@ -17,6 +17,7 @@ int __weak soc_clk_dump(void) struct uclass *uc; struct clk clk; int ret; + ulong rate; /* Device addresses start at 1 */ ret = uclass_get(UCLASS_CLK, &uc); @@ -26,20 +27,23 @@ int __weak soc_clk_dump(void) uclass_foreach_dev(dev, uc) { memset(&clk, 0, sizeof(clk)); ret = device_probe(dev); - if (ret) { - printf("%-30.30s : ? Hz\n", dev->name); - continue; - } + if (ret) + goto noclk; ret = clk_request(dev, &clk); - if (ret) { - printf("%-30.30s : ? Hz\n", dev->name); - continue; - } - - printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk)); + if (ret) + goto noclk; + rate = clk_get_rate(&clk); clk_free(&clk); + + if (rate == -ENODEV) + goto noclk; + + printf("%-30.30s : %lu Hz\n", dev->name, rate); + continue; + noclk: + printf("%-30.30s : ? Hz\n", dev->name); } return 0; -- cgit v1.1 From 41e30dcf87962e4bcc8d4197b3d808af14f71e92 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 18 Mar 2019 04:49:21 +0100 Subject: cmd: mmc: Make Mode: printout consistent The "Mode :" line is the only one in "mmc info" output that has a space in front of the colon. Drop the space to make it consistent with the rest of the output, e.g.: => mmc dev 1 ; mmc info switch to partitions #0, OK mmc1 is current device Device: sd@ee160000 Manufacturer ID: 3 OEM: 5344 Name: SL08G Bus Speed: 50000000 Mode : SD High Speed (50MHz) ^------------------------------ Remove this space Rd Block Len: 512 SD version 3.0 High Capacity: Yes Capacity: 7.4 GiB Bus Width: 1-bit Erase Group Size: 512 Bytes Signed-off-by: Marek Vasut Cc: Jaehoon Chung CC: Tom Rini --- cmd/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/mmc.c b/cmd/mmc.c index 8bc3648..6f3cb85 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -26,7 +26,7 @@ static void print_mmcinfo(struct mmc *mmc) printf("Bus Speed: %d\n", mmc->clock); #if CONFIG_IS_ENABLED(MMC_VERBOSE) - printf("Mode : %s\n", mmc_mode_name(mmc->selected_mode)); + printf("Mode: %s\n", mmc_mode_name(mmc->selected_mode)); mmc_dump_capabilities("card capabilities", mmc->card_caps); mmc_dump_capabilities("host capabilities", mmc->host_caps); #endif -- cgit v1.1