]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: fix the console output of clk_register
authorDario Binacchi <dariobin@libero.it>
Sat, 2 May 2020 15:38:11 +0000 (17:38 +0200)
committerLukasz Majewski <lukma@denx.de>
Mon, 24 Aug 2020 09:03:26 +0000 (11:03 +0200)
The parent->name variable can be used only in case the
uclass_get_device_by_name routine returns successfully.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
drivers/clk/clk.c

index 0f55ba751c0f960659b41a392e2acd17e62ac962..786f4e887e7aa405f18ed6016f80642820f99d6f 100644 (file)
@@ -22,13 +22,13 @@ int clk_register(struct clk *clk, const char *drv_name,
 
        ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);
        if (ret) {
-               printf("%s: name: %s parent: %s [0x%p]\n",
-                      __func__, name, parent->name, parent);
+               printf("%s: failed to get %s device (parent of %s)\n",
+                      __func__, parent_name, name);
+       } else {
+               debug("%s: name: %s parent: %s [0x%p]\n", __func__, name,
+                     parent->name, parent);
        }
 
-       debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, parent->name,
-             parent);
-
        drv = lists_driver_lookup_name(drv_name);
        if (!drv) {
                printf("%s: %s is not a valid driver name\n",