* [U-Boot] [PATCH v4] cmd: clk: Handle ENODEV from clk_get_rate
@ 2019-03-18 12:27 Ismael Luceno Cortes
2019-04-15 12:31 ` Ismael Luceno Cortes
0 siblings, 1 reply; 3+ messages in thread
From: Ismael Luceno Cortes @ 2019-03-18 12:27 UTC (permalink / raw)
To: u-boot
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 <ismael.luceno@silicon-gears.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
---
Notes:
Changes since v3:
- Moved the "rate" variable declaration to the begining of the function.
Changes since v2:
- Further improved commit message.
Changes since v1:
- Added further explanation to the commit message.
cmd/clk.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/cmd/clk.c b/cmd/clk.c
index fd4231589c..5402c87de7 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;
base-commit: 9ba5e5bc261a16f51662490da0cf620dc7f29013
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH v4] cmd: clk: Handle ENODEV from clk_get_rate
2019-03-18 12:27 [U-Boot] [PATCH v4] cmd: clk: Handle ENODEV from clk_get_rate Ismael Luceno Cortes
@ 2019-04-15 12:31 ` Ismael Luceno Cortes
2019-04-15 12:48 ` Marek Vasut
0 siblings, 1 reply; 3+ messages in thread
From: Ismael Luceno Cortes @ 2019-04-15 12:31 UTC (permalink / raw)
To: u-boot
On 18/Mar/2019 13:26, Ismael Luceno wrote:
> 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 <ismael.luceno@silicon-gears.com>
> Reviewed-by: Matthias Brugger <mbrugger@suse.com>
> Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
<...>
Ping.
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot] [PATCH v4] cmd: clk: Handle ENODEV from clk_get_rate
2019-04-15 12:31 ` Ismael Luceno Cortes
@ 2019-04-15 12:48 ` Marek Vasut
0 siblings, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2019-04-15 12:48 UTC (permalink / raw)
To: u-boot
On 4/15/19 2:31 PM, Ismael Luceno Cortes wrote:
> On 18/Mar/2019 13:26, Ismael Luceno wrote:
>> 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 <ismael.luceno@silicon-gears.com>
>> Reviewed-by: Matthias Brugger <mbrugger@suse.com>
>> Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
> <...>
>
> Ping.
>
I'll pick it through the SH tree so it doesn't get forgotten.
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-15 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-18 12:27 [U-Boot] [PATCH v4] cmd: clk: Handle ENODEV from clk_get_rate Ismael Luceno Cortes
2019-04-15 12:31 ` Ismael Luceno Cortes
2019-04-15 12:48 ` Marek Vasut
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.