Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df58f37b authored by Rob Herring's avatar Rob Herring Committed by David S. Miller
Browse files

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: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b9871a3
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -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;