Skip to contentSkip to conversation

clk: fix the console output of clk_register

PATCH New Dario Binacchi 1 participant 1 message May 2, 2020 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: fix the console output of clk_register

The parent->name variable can be used only in case the uclass_get_device_by_name routine returns successfully.

---

 drivers/clk/clk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk.c +5 -5
index 4c477a488e..2ca8d63c5d 100644
@@ -21,13 +21,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",
Signature · 1 line
2.17.1