aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@seco.com>2021-03-31 13:50:36 -0400
committerTom Rini <trini@konsulko.com>2021-04-19 16:13:43 -0400
commit4f60b163efab31a845fe53b433f6bd718d087e48 (patch)
treedcc9ee7ea26ad7b3de9874b228457125c9abd925
parent9bd52512859970ad7b8216579fab70d01d91b84f (diff)
downloadu-boot-4f60b163efab31a845fe53b433f6bd718d087e48.zip
u-boot-4f60b163efab31a845fe53b433f6bd718d087e48.tar.gz
u-boot-4f60b163efab31a845fe53b433f6bd718d087e48.tar.bz2
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>
-rw-r--r--drivers/gpio/gpio-uclass.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index e4e7f58..131099c 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1215,9 +1215,9 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
{
int ret;
- ret = dev_read_phandle_with_args(dev, list_name, "#gpio-cells", 0, -1,
- NULL);
- if (ret) {
+ ret = dev_count_phandle_with_args(dev, list_name, "#gpio-cells",
+ -ENOENT);
+ if (ret < 0) {
debug("%s: Node '%s', property '%s', GPIO count failed: %d\n",
__func__, dev->name, list_name, ret);
}