From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sat, 20 Jul 2019 20:51:15 -0600 Subject: [U-Boot] [PATCH v2 05/18] autoboot: Use CONFIG_AUTOBOOT_STOP_STR_SHA256 indirectly In-Reply-To: <20190721025128.30351-1-sjg@chromium.org> References: <20190721025128.30351-1-sjg@chromium.org> Message-ID: <20190721025128.30351-6-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This CONFIG option is only present if CONFIG_AUTOBOOT_ENCRYPTION is enabled so it cannot be used in code without that #ifdef. But we want to reduce the use of #ifdef in this file and in particular to avoid having two different functions both named passwd_abort() but which do different things. In preparation for this, create an intermediate value which is set to an empty string if there is no value for CONFIG_AUTOBOOT_STOP_STR_SHA256. Signed-off-by: Simon Glass --- Changes in v2: None common/autoboot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/autoboot.c b/common/autoboot.c index 94133eaeda..e3086e3828 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -28,6 +28,12 @@ DECLARE_GLOBAL_DATA_PTR; /* Stored value of bootdelay, used by autoboot_command() */ static int stored_bootdelay; +#ifdef CONFIG_AUTOBOOT_ENCRYPTION +#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256 +#else +#define AUTOBOOT_STOP_STR_SHA256 "" +#endif + #if defined(CONFIG_AUTOBOOT_KEYED) #if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256) @@ -61,7 +67,7 @@ static int passwd_abort(uint64_t etime) int ret; if (sha_env_str == NULL) - sha_env_str = CONFIG_AUTOBOOT_STOP_STR_SHA256; + sha_env_str = AUTOBOOT_STOP_STR_SHA256; /* * Generate the binary value from the environment hash value -- 2.22.0.657.g960e92d24f-goog