summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTeresa Remmet <t.remmet@phytec.de>2018-11-20 14:47:10 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-21 09:02:49 +0100
commit425d1c404d6b5c366e563d166b41dafcea4d166a (patch)
treef6e6eacf968a7beadcfc84e5e6f98663c7eb1a29 /arch
parent9643f3d9fa5f8c057c80bfd581ebcc91690f84c1 (diff)
downloadbarebox-425d1c404d6b5c366e563d166b41dafcea4d166a.tar.gz
barebox-425d1c404d6b5c366e563d166b41dafcea4d166a.tar.xz
arm: boards: phytec-som-am335x: Fix mac overwrite from state
state_read_mac() returns 0 on success so mac never was overwritten. Fix this and add check for valid mac address. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/phytec-som-am335x/board.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/boards/phytec-som-am335x/board.c b/arch/arm/boards/phytec-som-am335x/board.c
index 8c24f2b332..441d56348c 100644
--- a/arch/arm/boards/phytec-som-am335x/board.c
+++ b/arch/arm/boards/phytec-som-am335x/board.c
@@ -73,7 +73,7 @@ static const char *eth_names[ETH_COUNT] = {"mac0", "mac1"};
static int physom_devices_init(void)
{
struct state *state;
- u8 mac[6];
+ uint8_t mac[6];
int state_ret;
int state_i;
@@ -130,7 +130,7 @@ static int physom_devices_init(void)
for (state_i = 0; state_i < 2; state_i++) {
state_ret = state_read_mac(state,
eth_names[state_i], &mac[0]);
- if (state_ret == 6)
+ if (!state_ret && is_valid_ether_addr(&mac[0]))
eth_register_ethaddr(state_i, mac);
}
}