diff --git a/drivers/of/base.c b/drivers/of/base.c index c485b1ee4aca..90c934bb91da 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -974,10 +974,10 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt /* The path could begin with an alias */ if (*path != '/') { int len; - const char *p = separator; + const char *p = strchrnul(path, '/'); - if (!p) - p = strchrnul(path, '/'); + if (separator && separator < p) + p = separator; len = p - path; /* of_aliases must not be NULL */