diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2015-03-31 18:57:16 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:17 -0600 |
commit | 2984e7a102aec85a39827b314bc898ebb5d2fdb9 (patch) | |
tree | aa69cbadf4241af85ea80f28efb9fd906b2567b1 | |
parent | f9f788f0721350e594ce3e7978968847b057afc1 (diff) | |
download | u-boot-imx-2984e7a102aec85a39827b314bc898ebb5d2fdb9.zip u-boot-imx-2984e7a102aec85a39827b314bc898ebb5d2fdb9.tar.gz u-boot-imx-2984e7a102aec85a39827b314bc898ebb5d2fdb9.tar.bz2 |
dm: gpio: request list: return the count if requests max_count reached
The function gpio_request_list_by_name_nodev() returned -ENOSPC error,
when the loop count was greater than requested count. This was wrong,
because function should return the requested gpio count, when meets
the call request without errors. Now, the loop ends on requested
max_count.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/gpio/gpio-uclass.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index b6e1058..ca94bbb 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -590,11 +590,7 @@ int gpio_request_list_by_name_nodev(const void *blob, int node, int count; int ret; - for (count = 0; ; count++) { - if (count >= max_count) { - ret = -ENOSPC; - goto err; - } + for (count = 0; count < max_count; count++) { ret = _gpio_request_by_name_nodev(blob, node, list_name, count, &desc[count], flags, true); if (ret == -ENOENT) |