diff mbox

[U-Boot,V2,1/3] dm: gpio: request list: return the count if requests max_count reached

Message ID 1427477624-23127-2-git-send-email-p.marczak@samsung.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Przemyslaw Marczak March 27, 2015, 5:33 p.m. UTC
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>
Cc: Simon Glass <sjg@chromium.org>
---
 drivers/gpio/gpio-uclass.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Simon Glass March 28, 2015, 3:04 p.m. UTC | #1
On 27 March 2015 at 11:33, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>
> 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>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  drivers/gpio/gpio-uclass.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index a69bbd2..4b63025 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)