diff mbox

[U-Boot,v5,04/26] env: Fix return values in env_attr_lookup()

Message ID 1432150059-24238-5-git-send-email-joe.hershberger@ni.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Joe Hershberger May 20, 2015, 7:27 p.m. UTC
This function returned numbers for error codes. Change them to error
codes.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/env_attr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Tom Rini May 23, 2015, 12:40 p.m. UTC | #1
On Wed, May 20, 2015 at 02:27:17PM -0500, Joe Hershberger wrote:

> This function returned numbers for error codes. Change them to error
> codes.
> 
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/env_attr.c b/common/env_attr.c
index 64baca5..e791f44 100644
--- a/common/env_attr.c
+++ b/common/env_attr.c
@@ -148,10 +148,10 @@  int env_attr_lookup(const char *attr_list, const char *name, char *attributes)
 
 	if (!attributes)
 		/* bad parameter */
-		return -1;
+		return -EINVAL;
 	if (!attr_list)
 		/* list not found */
-		return 1;
+		return -EINVAL;
 
 	entry = reverse_strstr(attr_list, name, NULL);
 	while (entry != NULL) {
@@ -209,5 +209,5 @@  int env_attr_lookup(const char *attr_list, const char *name, char *attributes)
 	}
 
 	/* not found in list */
-	return 2;
+	return -ENOENT;
 }