Skip to contentSkip to conversation

sbus: Use of_get_child_by_name helper

PATCH Applied Rob Herring 2 participants 2 messages Aug 29, 2018 – Oct 8, 2018 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sbus: Use of_get_child_by_name helper

Use the of_get_child_by_name() helper instead of open coding searching for the '/options' node. This removes directly accessing the name pointer as well.

---
 drivers/sbus/char/openprom.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/sbus/char/openprom.c +1 -10
index 7b31f19ade83..050879a2ddef 100644
@@ -715,22 +715,13 @@ static struct miscdevice openprom_dev = {
 
 static int __init openprom_init(void)
 {
-	struct device_node *dp;
 	int err;
 
 	err = misc_register(&openprom_dev);
 	if (err)
 		return err;
 
-	dp = of_find_node_by_path("/");
-	dp = dp->child;
-	while (dp) {
-		if (!strcmp(dp->name, "options"))
-			break;
-		dp = dp->sibling;
-	}
-	options_node = dp;
-
+	options_node = of_get_child_by_name(of_find_node_by_path("/"), "options");
 	if (!options_node) {
 		misc_deregister(&openprom_dev);
 		return -EIO;
Signature · 1 line
2.17.1