From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1763C19F2A for ; Sun, 7 Aug 2022 19:06:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC6BF84863; Sun, 7 Aug 2022 21:06:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="R6DnlhYv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 69284848AF; Sun, 7 Aug 2022 21:06:24 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (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 75A4D83FAD for ; Sun, 7 Aug 2022 21:06:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22143B80881; Sun, 7 Aug 2022 19:06:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0E47C433D6; Sun, 7 Aug 2022 19:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899180; bh=a+a9IXwCpyh8hSfjRn3PH/x/cgqPAsMgem3aIfGGRK4=; h=From:To:Cc:Subject:Date:From; b=R6DnlhYvEsL2CAIfy67sjlg5Cgb6se9s20ntFCFXp9c9yznhilXpqJNtPmGsV/OEt +Isyg+IMioLzcmKcj2urjeNzOe3epj2+y6F6isJqc5mxgGmlH09qQ3+Jk0C427tlBR Z+hvvfMhodUKU1yrz2W32/3jVrI3H1oXMb8qTNJ0UxT3hoVqYGjRQteC1wC1DxyInJ gqDK6QiQbwup3kfX6833sZTdBJ5ty59gPtA4tQ+rROKK6949AJZR6q0eJ/c2JGSfiX DNcaferA35kwY32Tu5EmXa1CvRVz2GLNAlb/95zGBKWsNRdx904WZ2tctK/zdAYi6V gpWcNYQiQ0vEQ== Received: by pali.im (Postfix) id DC10397B; Sun, 7 Aug 2022 21:06:17 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Wolfgang Denk Cc: u-boot@lists.denx.de Subject: [PATCH] hwconfig: Allow to use restricted env Date: Sun, 7 Aug 2022 21:06:04 +0200 Message-Id: <20220807190604.20318-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean During early boot phase GD_FLG_ENV_READY is not set but env_get() may work when env is ready in restricted mode. Do not fail with error message "WARNING: Calling __hwconfig without a buffer and before environment is ready" when env is already working by checking for ENV_VALID flag. Signed-off-by: Pali Rohár --- common/hwconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hwconfig.c b/common/hwconfig.c index 43566b81bd48..cac0b6348f46 100644 --- a/common/hwconfig.c +++ b/common/hwconfig.c @@ -78,7 +78,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen, /* if we are passed a buffer use it, otherwise try the environment */ if (!env_hwconfig) { - if (!(gd->flags & GD_FLG_ENV_READY)) { + if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) { printf("WARNING: Calling __hwconfig without a buffer " "and before environment is ready\n"); return NULL; -- 2.20.1