From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olliver Schinagl Date: Mon, 15 May 2017 10:02:33 +0200 Subject: [U-Boot] [PATCHv6 17/28] fdt: fixup_eth: improve error catching/reduce identation In-Reply-To: <20170515080244.21345-1-oliver@schinagl.nl> References: <20170515080244.21345-1-oliver@schinagl.nl> Message-ID: <20170515080244.21345-18-oliver@schinagl.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Currently when checking for an error in ethernet aliases in the fdt, we only check for the error case -1. It is safer to ignore anything < 0. By rearranging logic a bit we can now also reduce identation. Signed-off-by: Olliver Schinagl --- common/fdt_support.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index 4d05465232..71cbee43e0 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -501,20 +501,20 @@ void fdt_fixup_ethernet(void *fdt) else i = trailing_strtol(name); - if (i != -1) { - if (i == 0) - strcpy(mac, "ethaddr"); - else - sprintf(mac, "eth%daddr", i); - } else { + if (i < 0) continue; - } + + if (i == 0) + strcpy(mac, "ethaddr"); + else + sprintf(mac, "eth%daddr", i); + fdt_eth_addr = getenv(mac); - if (!fdt_eth_addr) + if (fdt_eth_addr) + eth_parse_enetaddr(fdt_eth_addr, mac_addr); + else continue; - eth_parse_enetaddr(fdt_eth_addr, mac_addr); - do_fixup_by_path(fdt, path, "mac-address", &mac_addr, 6, 0); do_fixup_by_path(fdt, path, "local-mac-address", -- 2.11.0