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.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Rob Herring 2018-08-29 15:03:37 -05:00 committed by David S. Miller
parent 0b9871a3a8
commit df58f37b5d
1 changed files with 1 additions and 10 deletions

View File

@ -715,22 +715,13 @@ static struct miscdevice openprom_dev = {
static int __init openprom_init(void) static int __init openprom_init(void)
{ {
struct device_node *dp;
int err; int err;
err = misc_register(&openprom_dev); err = misc_register(&openprom_dev);
if (err) if (err)
return err; return err;
dp = of_find_node_by_path("/"); options_node = of_get_child_by_name(of_find_node_by_path("/"), "options");
dp = dp->child;
while (dp) {
if (!strcmp(dp->name, "options"))
break;
dp = dp->sibling;
}
options_node = dp;
if (!options_node) { if (!options_node) {
misc_deregister(&openprom_dev); misc_deregister(&openprom_dev);
return -EIO; return -EIO;