dm: gpio: Fix gpio_get_list_count failing with livetree
of_parse_phandle_with_args (called by dev_read_phandle_with_args) does not
support getting the length of a phandle list by using the index -1.
Instead, use dev_count_phandle_with_args which supports exactly this
use-case.
Fixes: 8558217153
("gpio: Convert to use APIs which support live DT")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8ddaf94358
commit
430e136dc1
|
@ -1215,9 +1215,9 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = dev_read_phandle_with_args(dev, list_name, "#gpio-cells", 0, -1,
|
ret = dev_count_phandle_with_args(dev, list_name, "#gpio-cells",
|
||||||
NULL);
|
-ENOENT);
|
||||||
if (ret) {
|
if (ret < 0) {
|
||||||
debug("%s: Node '%s', property '%s', GPIO count failed: %d\n",
|
debug("%s: Node '%s', property '%s', GPIO count failed: %d\n",
|
||||||
__func__, dev->name, list_name, ret);
|
__func__, dev->name, list_name, ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue