Re: [PATCH] net: change return values in mac_pton() function

From: Alexey Dobriyan
Date: Wed Jul 13 2011 - 06:09:12 EST


On Wed, Jul 13, 2011 at 12:30 PM, Arend van Spriel <arend@xxxxxxxxxxxx> wrote:
> The original commit adding this function noted a diverge from usual
> 0=success/-E=fail, but no motivation for it.

I thought it was obvious, but indeed wasn't explicitely
mentioned in changelog. But see inet_pton(3).

> To stay consistent this
> commit adheres to the usual approach. The callers check for result
> is changed from 'if(!mac_pton(x, y))' to 'if(mac_pton(x,y) < 0)'.

> @@ -304,20 +304,20 @@ int mac_pton(const char *s, u8 *mac)
>
>        /* XX:XX:XX:XX:XX:XX */
>        if (strlen(s) < 3 * ETH_ALEN - 1)
> -               return 0;
> +               return -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/