From patchwork Wed Apr 21 02:04:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix.Vietmeyer@jila.colorado.edu X-Patchwork-Id: 1468674 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FQHpz3C6jz9sjB for ; Wed, 21 Apr 2021 21:08:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7981482B2C; Wed, 21 Apr 2021 13:08:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jila.colorado.edu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D96AD8289B; Wed, 21 Apr 2021 04:04:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from jilau1.colorado.edu (jilau1.colorado.edu [128.138.140.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8F0F2819C3 for ; Wed, 21 Apr 2021 04:04:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jila.colorado.edu Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=Felix.Vietmeyer@jila.colorado.edu Received: from jilau1.colorado.edu (localhost [127.0.0.1]) by jilau1.colorado.edu (Postfix) with ESMTP id 7D6928800A4 for ; Tue, 20 Apr 2021 20:04:26 -0600 (MDT) Received: from 108.18.223.253 (SquirrelMail authenticated user fevi8970) by jilau1.colorado.edu with HTTP; Tue, 20 Apr 2021 20:04:26 -0600 Message-ID: <02f1e164b5d59237dd8cd221c9f7f96a.squirrel@jilau1.colorado.edu> Date: Tue, 20 Apr 2021 20:04:26 -0600 Subject: [PATCH] env: Load env when ENV_IS_NOWHERE is only location selected From: Felix.Vietmeyer@jila.colorado.edu To: u-boot@lists.denx.de User-Agent: SquirrelMail/1.4.23 [SVN] MIME-Version: 1.0 X-Priority: 3 (Normal) Importance: Normal X-Mailman-Approved-At: Wed, 21 Apr 2021 13:08:13 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This patch prevent u-boot from hanging on a UltraZed EG board (zynqmp). Without the patch, (drv = env_driver_lookup(ENVOP_INIT, prio)) evaluates to 0, causing prio = 0 Then, (!prio) is hit, returning -ENODEV causing a stall. With the patch, instead of returning -ENODEV and causing a stall, we set gd->env_addr (is this really needed?) and then mark gd->env_valid = ENV_INVALID to use the default env. --- env/env.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/env/env.c b/env/env.c index e534008006..44a65ab216 100644 --- a/env/env.c +++ b/env/env.c @@ -335,17 +335,18 @@ int env_init(void) debug("%s: Environment %s init done (ret=%d)\n", __func__, drv->name, ret); - - if (gd->env_valid == ENV_INVALID) - ret = -ENOENT; } - if (!prio) - return -ENODEV; + if (!prio) { + gd->env_addr = (ulong)&default_environment[0]; + gd->env_valid = ENV_INVALID; + + return 0; + } if (ret == -ENOENT) { gd->env_addr = (ulong)&default_environment[0]; - gd->env_valid = ENV_VALID; + gd->env_valid = ENV_INVALID; return 0; }