]> git.hungrycats.org Git - linux/commit
of: handle both '/' and ':' in path strings
authorBrian Norris <computersforpeace@gmail.com>
Tue, 17 Mar 2015 19:30:31 +0000 (12:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 12:59:47 +0000 (13:59 +0100)
commit5f83b8d79d822abbc73f9efb48aa59dc8c679415
treef616c74d14c3e714f0d4d22c7a49178819713312
parent8b78939bb04654d3b02ffb66d6b9d2a223119663
of: handle both '/' and ':' in path strings

commit 721a09e95c786346b4188863a1cfa3909c76f690 upstream.

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>
Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/base.c