With deep probe enabled, we are guaranteed that struct device_node::dev is populated whenever a device had been created for a node, so in that case, skip the iteration over the linked list of registered devices. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/of/platform.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 7f377b8b378a..dc784ea8e550 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -28,6 +28,9 @@ struct device_d *of_find_device_by_node(struct device_node *np) if (ret) return NULL; + if (deep_probe_is_supported()) + return np->dev; + for_each_device(dev) if (dev->device_node == np) return dev; -- 2.30.2