mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] net: Fix error return value for string_to_ethaddr
Date: Mon, 20 Jan 2014 14:13:07 +0100	[thread overview]
Message-ID: <1390223587-6519-1-git-send-email-s.hauer@pengutronix.de> (raw)

Return a proper error code instead of -1 which would be -EPERM.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/net.c b/net/net.c
index 9ef0784..20051bc 100644
--- a/net/net.c
+++ b/net/net.c
@@ -143,12 +143,12 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6])
 
         if (!str || strlen(str) != 17) {
 		memset(enetaddr, 0, 6);
-		return -1;
+		return -EINVAL;
 	}
 
         if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
                         str[11] != ':' || str[14] != ':')
-                return -1;
+                return -EINVAL;
 
 	for (reg = 0; reg < 6; ++reg) {
 		enetaddr[reg] = simple_strtoul (str, &e, 16);
-- 
1.8.5.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2014-01-20 13:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390223587-6519-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox