public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] rpi: set ethaddr as well
Date: Fri, 5 Feb 2016 21:06:54 -0700	[thread overview]
Message-ID: <56B5715E.6040604@wwwdotorg.org> (raw)
In-Reply-To: <1454512089-26346-1-git-send-email-lkundrak@v3.sk>

On 02/03/2016 08:08 AM, Lubomir Rintel wrote:
> Let's set "ethaddr" when we get the ethernet address too, so that
> fdt_fixup_ethernet() sets the address in the device tree and the Linux
> driver can pick it up.

You need to Cc the maintainer who will apply this (Tom Rini).

This seems OK, but ...

> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> index b344362..d7ad79d 100644
> --- a/board/raspberrypi/rpi/rpi.c
> +++ b/board/raspberrypi/rpi/rpi.c
> @@ -254,6 +254,9 @@ static void set_usbethaddr(void)
>  
>  	eth_setenv_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
>  
> +	if (!getenv("ethaddr"))
> +		setenv("ethaddr", getenv("usbethaddr"));

Rather than setting duplicate environment variables, wouldn't it be
better to modify the code that copies ethaddr into the DT so that it
used the correct environment variable for the platform? Perhaps that's
not worth it though.

Why use setenv() directly rather than just calling eth_setenv_enetaddr()
in both places? In the current code, I wonder what happens if
eth_setenv_enetaddr() fails, so presumably getenv() returns NULL or
whatever random value usbethaddr had since it wasn't over-written?

Tested-by: Stephen Warren <swarren@wwwdotorg.org>

  reply	other threads:[~2016-02-06  4:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 15:08 [U-Boot] [PATCH] rpi: set ethaddr as well Lubomir Rintel
2016-02-06  4:06 ` Stephen Warren [this message]
2016-02-08 20:49 ` [U-Boot] " Tom Rini

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=56B5715E.6040604@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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