diff mbox series

net: eth-uclass: Do not return error when no MAC is found

Message ID CAOMZO5COpzD0PVH3O1qy99psMod=68NOO8j1383Y49N+CJs0QQ@mail.gmail.com
State New
Headers show
Series net: eth-uclass: Do not return error when no MAC is found | expand

Commit Message

Fabio Estevam March 10, 2020, 6:34 p.m. UTC
Hi Joe,

On Tue, Mar 10, 2020 at 2:45 PM Joe Hershberger <joe.hershberger at ni.com> wrote:

> I tried to apply this but it breaks the unit tests. I guess you didn't
> try "ut dm" in sandbox?
>
> https://travis-ci.org/jhershbe/u-boot/builds/660395782
>
> Please test those and update the tests to pass with your change.

Ok, I will revisit this patch after 2020.04.

I think we should probably let net_random_ethaddr() run unconditionally:


Thanks

Comments

Joe Hershberger March 11, 2020, 5:14 p.m. UTC | #1
On Tue, Mar 10, 2020 at 1:34 PM Fabio Estevam <festevam at gmail.com> wrote:
>
> Hi Joe,
>
> On Tue, Mar 10, 2020 at 2:45 PM Joe Hershberger <joe.hershberger at ni.com> wrote:
>
> > I tried to apply this but it breaks the unit tests. I guess you didn't
> > try "ut dm" in sandbox?
> >
> > https://travis-ci.org/jhershbe/u-boot/builds/660395782
> >
> > Please test those and update the tests to pass with your change.
>
> Ok, I will revisit this patch after 2020.04.
>
> I think we should probably let net_random_ethaddr() run unconditionally:

That may be a better solution... with the warning of course.

Cheers,
-Joe

> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -547,15 +547,9 @@ static int eth_post_probe(struct udevice *dev)
>                        dev->name);
>         } else if (is_zero_ethaddr(pdata->enetaddr) ||
>                    !is_valid_ethaddr(pdata->enetaddr)) {
> -#ifdef CONFIG_NET_RANDOM_ETHADDR
>                 net_random_ethaddr(pdata->enetaddr);
>                 printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
>                        dev->name, dev->seq, pdata->enetaddr);
> -#else
> -               printf("\nError: %s address not set.\n",
> -                      dev->name);
> -               return -EINVAL;
> -#endif
>         }
>
>         eth_write_hwaddr(dev);
>
> Thanks
Fabio Estevam March 11, 2020, 5:19 p.m. UTC | #2
Hi Joe,

On Wed, Mar 11, 2020 at 2:15 PM Joe Hershberger <joe.hershberger at ni.com> wrote:

> That may be a better solution... with the warning of course.

Thanks for the feedback.

I will submit this solution after 2020.04 is out.

Thanks
diff mbox series

Patch

--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -547,15 +547,9 @@  static int eth_post_probe(struct udevice *dev)
                       dev->name);
        } else if (is_zero_ethaddr(pdata->enetaddr) ||
                   !is_valid_ethaddr(pdata->enetaddr)) {
-#ifdef CONFIG_NET_RANDOM_ETHADDR
                net_random_ethaddr(pdata->enetaddr);
                printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
                       dev->name, dev->seq, pdata->enetaddr);
-#else
-               printf("\nError: %s address not set.\n",
-                      dev->name);
-               return -EINVAL;
-#endif
        }

        eth_write_hwaddr(dev);