[U-Boot] [RFC PATCH 2/7] net: dm: Ignore unknown env_op_* constants

Simon Glass sjg at chromium.org
Fri Jul 15 05:19:48 CEST 2016


Hi Bernhard,

On 11 July 2016 at 12:14, Bernhard Nortmann <bernhard.nortmann at web.de> wrote:
> This prevents a possible compiler warning similar to
> "net/eth-uclass.c:<line>:<pos>: warning: enumeration value
> 'env_op_*' not handled in switch [-Wswitch]".
>
> Signed-off-by: Bernhard Nortmann <bernhard.nortmann at web.de>
> ---
>
>  net/eth-uclass.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Simon Glass <sjg at chromium.org>

> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index c15cc4d..e38edd7 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -230,6 +230,8 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,
>                         break;
>                 case env_op_delete:
>                         memset(pdata->enetaddr, 0, 6);
> +               default:
> +                       break; /* ignore */

Presumably hitting the default would be an internal error. So in that
case there is no point in returning an error, I think, and what you
have is best.

>                 }
>         }
>
> --
> 2.7.3
>

Regards,
Simon


More information about the U-Boot mailing list