From patchwork Mon Mar 13 13:04:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 95218 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1164339qgd; Mon, 13 Mar 2017 06:09:53 -0700 (PDT) X-Received: by 10.28.196.68 with SMTP id u65mr10461057wmf.8.1489410593109; Mon, 13 Mar 2017 06:09:53 -0700 (PDT) Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id w5si598572wra.125.2017.03.13.06.09.52; Mon, 13 Mar 2017 06:09:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 8EE5CC21C79; Mon, 13 Mar 2017 13:06:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B7368C21C71; Mon, 13 Mar 2017 13:06:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C83DAC21C66; Mon, 13 Mar 2017 13:06:03 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id 8A998C21C4E for ; Mon, 13 Mar 2017 13:05:59 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v2DD4vjf030142; Mon, 13 Mar 2017 08:04:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1489410297; bh=WlVhfuvpH4LT4Klton4O1VrsQxusAUK77FEJqSGHo/Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Becx9wdmShx5MHSTPdcAI2P9qVGD0bNZuB8/qc6aGuqdD34xlRKnV366TRD3dvbGH OiAiUx3hjXhMbPwlikofPQoqRR/10fUS+nbPXMO8eyuWbgovc2ZcsFsKtnUybkfzCx KDfjOwhXYyRlAhxHgzCVRQdTlhox66IbOIED7oww= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2DD4vpc002339; Mon, 13 Mar 2017 08:04:57 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Mon, 13 Mar 2017 08:04:56 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2DD4YjT003968; Mon, 13 Mar 2017 08:04:55 -0500 From: Roger Quadros To: Date: Mon, 13 Mar 2017 15:04:33 +0200 Message-ID: <1489410273-10159-11-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489410273-10159-1-git-send-email-rogerq@ti.com> References: <1489410273-10159-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [u-boot PATCH v4 10/10] net: don't override ethernet address environment X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever. Signed-off-by: Roger Quadros Reviewed-by: Tom Rini --- net/eth_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/eth_common.c b/net/eth_common.c index e9d3c66..58fa295 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -34,6 +34,9 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr) { char buf[ARP_HLEN_ASCII + 1]; + if (eth_getenv_enetaddr(name, (uchar *)buf)) + return -EEXIST; + sprintf(buf, "%pM", enetaddr); return setenv(name, buf);