From patchwork Fri May 29 17:51:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1300909 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=nAvP6i6C; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49YXDw09bkz9sSk for ; Sat, 30 May 2020 03:51:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 164F081015; Fri, 29 May 2020 19:51:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1590774685; bh=2jZs4di79zVihkrA09Oxj2Yk0rJJ+WRTWd4VjLw4RxA=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=nAvP6i6C6oDLpLd/j58SNJi3/G5eznpjBdAes9yXDaBNQKKH94qM9CIV/HE1C3xoo 3+AfbBrzYhCqp6DRgIeFkK0c8l5m+tJHObgVQEN/RJHzw+GpVL15iBM5Fmqz7R5goX GHjL8QJIEhimkTJ9thdGolHhfmKxlMS8iaS7JFs7phoLaKIvIqvp84sGly0Ufxz9uJ L7upMQh87x4m9+x1RpJA1QA4CmXfF5yFvlEY78YgfhK7+wtQ1R3nkNfjEAbBABjBDX mH4NxE3eEwAEZMF3VS03IGUb0fCONAP/JVVrHUs7OUyxzPxxr/hweG4Me5j7pyGNCo 6kQgKmcDJJTyw== Received: by phobos.denx.de (Postfix, from userid 109) id C3193813C6; Fri, 29 May 2020 19:51:23 +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,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (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 2032881015 for ; Fri, 29 May 2020 19:51:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49YXDm6Dyzz1qs0m; Fri, 29 May 2020 19:51:20 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49YXDm5zxsz1qqkT; Fri, 29 May 2020 19:51:20 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 916MHWueYLlA; Fri, 29 May 2020 19:51:19 +0200 (CEST) X-Auth-Info: Hu5OE7OrLJhd1ukrXRM8HO3Nl3pntmBi8ZOhkMzJosw= Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz [86.49.35.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 29 May 2020 19:51:19 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Cc: trini@konsulko.com, Marek Vasut Subject: [PATCH] env: Fix invalid env handling in env_init() Date: Fri, 29 May 2020 19:51:15 +0200 Message-Id: <20200529175115.627228-1-marex@denx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean In case the env storage driver marks environment as ENV_INVALID, we must reset the $ret return value to -ENOENT to let the env init code reset the environment to the default one a bit further down. Signed-off-by: Marek Vasut --- env/env.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/env/env.c b/env/env.c index dcc25c030b..024d36fdbe 100644 --- a/env/env.c +++ b/env/env.c @@ -300,6 +300,9 @@ 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)