aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-03-17 15:30:31 -0400
committerRob Herring <robh@kernel.org>2015-03-19 09:42:43 -0400
commit721a09e95c786346b4188863a1cfa3909c76f690 (patch)
treea3d66aae17d7861b6709e15385af01fffbb250ba /drivers/of
parent5ca1b0dd016701f67994414a2af50dec6efcf103 (diff)
of: handle both '/' and ':' in path strings
Commit 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") caused a regression in OF handling of stdout-path. While it fixes some cases which have '/' after the ':', it breaks cases where there is more than one '/' *before* the ':'. For example, it breaks this boot string stdout-path = "/rdb/serial@f040ab00:115200"; So rather than doing sequentialized checks (first for '/', then for ':'; or vice versa), to get the correct behavior we need to check for the first occurrence of either one of them. It so happens that the handy strcspn() helper can do just that. Fixes: 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: stable@vger.kernel.org # 3.19 Acked-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/base.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index adb8764861c0..966d6fdcf427 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -715,13 +715,8 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
715{ 715{
716 struct device_node *child; 716 struct device_node *child;
717 int len; 717 int len;
718 const char *end;
719 718
720 end = strchr(path, ':'); 719 len = strcspn(path, "/:");
721 if (!end)
722 end = strchrnul(path, '/');
723
724 len = end - path;
725 if (!len) 720 if (!len)
726 return NULL; 721 return NULL;
727 722