VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Saravana Kannan <saravanak@google.com> 2019-10-28 15:00:26 -0700 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2019-11-02 18:05:19 +0100 commit: 15956dad5c1016155c82d094f8c1273a30f79c3d parent: 0ff5cc1ec33b4b7540c4bc09f50123befc6ed947
Commit Summary:
of: property: Skip adding device links to suppliers that aren't devices
Diffstat:
1 file changed, 3 insertions, 1 deletion
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 69a6ec8711bd..e225ab17f598 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1024,6 +1024,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
 	struct device *sup_dev;
 	int ret = 0;
 	struct device_node *tmp_np = sup_np;
+	int is_populated;
 
 	of_node_get(sup_np);
 	/*
@@ -1048,9 +1049,10 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
 		return -EINVAL;
 	}
 	sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
+	is_populated = of_node_check_flag(sup_np, OF_POPULATED);
 	of_node_put(sup_np);
 	if (!sup_dev)
-		return -EAGAIN;
+		return is_populated ? 0 : -EAGAIN;
 	if (!device_link_add(dev, sup_dev, dl_flags))
 		ret = -EAGAIN;
 	put_device(sup_dev);