[PATCH] doc: Fix eth_env_[gs]et_enetaddr() return value
Marek Vasut
marex at denx.de
Sun Dec 18 08:05:47 CET 2022
On 12/18/22 07:37, Heinrich Schuchardt wrote:
>
>
> On 12/18/22 04:11, Marek Vasut wrote:
>> Per env/common.c, eth_env_get_enetaddr() returns the same return
>> values as is_valid_ethaddr(), i.e. true if valid, false otherwise.
>> Per env/common.c, eth_env_set_enetaddr() may return -EEXIST is the
>> ethaddr is already set. Fix both.
>>
>> Signed-off-by: Marek Vasut <marex at denx.de>
>> ---
>> Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> Cc: Marek Behún <marek.behun at nic.cz>
>> Cc: Simon Glass <sjg at chromium.org>
>> Cc: Tom Rini <trini at konsulko.com>
>> ---
>> include/env.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/env.h b/include/env.h
>> index 60acb5454ec..969737cb75e 100644
>> --- a/include/env.h
>> +++ b/include/env.h
>> @@ -226,7 +226,7 @@ int env_complete(char *var, int maxv, char
>> *cmdv[], int maxsz, char *buf,
>> *
>> * @name: Environment variable to get (e.g. "ethaddr")
>> * @enetaddr: Place to put MAC address (6 bytes)
>> - * Return: 0 if OK, 1 on error
>> + * Return: 1 if OK, 0 on error
>> */
>> int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
>> @@ -235,7 +235,7 @@ int eth_env_get_enetaddr(const char *name, uint8_t
>> *enetaddr);
>> *
>> * @name: Environment variable to set (e.g. "ethaddr")
>> * @enetaddr: Pointer to MAC address to put into the variable (6 bytes)
>> - * Return: 0 if OK, 1 on error
>> + * Return: 0 if OK, -ve on error
>
> env_set() will return 1 in case of an error. So how about:
>
> Return: 0 if OK, non-zero otherwise
Fixed.
This part of the api is really awfully confusing when it comes to return
codes, sigh ...
More information about the U-Boot
mailing list