From patchwork Mon Oct 21 23:03:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 1180915 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=walle.cc header.i=@walle.cc header.b="l43+gXRB"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xscx6xVTz9sCJ for ; Tue, 22 Oct 2019 10:03:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 90B87C21DED; Mon, 21 Oct 2019 23:03:22 +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 957C5C21C50; Mon, 21 Oct 2019 23:03:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 375EBC21C50; Mon, 21 Oct 2019 23:03:19 +0000 (UTC) Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lists.denx.de (Postfix) with ESMTPS id CA6BEC21BE5 for ; Mon, 21 Oct 2019 23:03:18 +0000 (UTC) Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 47AF122433; Tue, 22 Oct 2019 01:03:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1571698998; bh=TSjUtYd1iF+R7bWo07eNDFgv6iRl7OdvWhpyF7qpK54=; h=From:To:Cc:Subject:Date:From; b=l43+gXRBbAuYXlm0IHZ85xdYiSt1DW4XurSvGVDrnmnQRcjj9Jpf+Hx/ivFyp8y3+ FTVVeFWjNYHPV5MOtRcaHLPw3Htt+GGu9qgDrV+efgK6Dz66wDCsePg5gj7g6IGA5K uiydlNLnskVWHJZJsJzhn+P4tC9olsRPBYlex56Q= From: Michael Walle To: u-boot@lists.denx.de Date: Tue, 22 Oct 2019 01:03:10 +0200 Message-Id: <20191021230310.9990-1-michael@walle.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.101.4 at web X-Virus-Status: Clean Cc: Joe Hershberger Subject: [U-Boot] [PATCH] net: eth-uclass: ignore unavailable devices 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" device_probe() may fail in which case the seq_id will be -1. Don't display these devices during startup. While this is only a cosmetic change, the return value of eth_initialize() will also change to the actual number of available devices. The return value is only used in spl_net to decide whether there are any devices to boot from. So returning only available devices is also more correct in that case. Signed-off-by: Michael Walle Acked-by: Joe Hershberger --- net/eth-uclass.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 3bd98b01ad..acd59216e3 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -420,20 +420,25 @@ int eth_initialize(void) bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT); do { - if (num_devices) - printf(", "); + if (dev->seq != -1) { + if (num_devices) + printf(", "); - printf("eth%d: %s", dev->seq, dev->name); + printf("eth%d: %s", dev->seq, dev->name); - if (ethprime && dev == prime_dev) - printf(" [PRIME]"); + if (ethprime && dev == prime_dev) + printf(" [PRIME]"); + } eth_write_hwaddr(dev); + if (dev->seq != -1) + num_devices++; uclass_next_device_check(&dev); - num_devices++; } while (dev); + if (!num_devices) + printf("No ethernet found.\n"); putc('\n'); }