public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: "Simon Glass" <sjg@chromium.org>, "Pali Rohár" <pali@kernel.org>
Cc: u-boot@lists.denx.de, "Marek Behún" <marek.behun@nic.cz>
Subject: [PATCH v2 09/12] env: Change return behaviour of env_set_default_vars()
Date: Thu,  4 Nov 2021 00:23:29 +0100	[thread overview]
Message-ID: <20211103232332.2737-10-kabel@kernel.org> (raw)
In-Reply-To: <20211103232332.2737-1-kabel@kernel.org>

From: Marek Behún <marek.behun@nic.cz>

The env_set_default_vars() function does not document return value and
behaves differently from other env_* functions.

Change the return value to return 0 on success and -ve on error.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 env/common.c  | 9 ++++++---
 include/env.h | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/env/common.c b/env/common.c
index 208e2adaa0..cefe58561b 100644
--- a/env/common.c
+++ b/env/common.c
@@ -283,9 +283,12 @@ int env_set_default_vars(int nvars, char * const vars[], int flags)
 	 * (and use \0 as a separator)
 	 */
 	flags |= H_NOCLEAR | H_DEFAULT;
-	return himport_r(&env_htab, default_environment,
-				sizeof(default_environment), '\0',
-				flags, 0, nvars, vars);
+	if (!himport_r(&env_htab, default_environment,
+		       sizeof(default_environment), '\0', flags, 0, nvars,
+		       vars))
+		return -errno;
+
+	return 0;
 }
 
 /*
diff --git a/include/env.h b/include/env.h
index ee5e30d036..d0b95a498d 100644
--- a/include/env.h
+++ b/include/env.h
@@ -245,6 +245,7 @@ void env_fix_drivers(void);
  * @nvars: Number of variables to set/reset
  * @vars: List of variables to set/reset
  * @flags: Flags controlling matching (H_... - see search.h)
+ * @return 0 if OK, -ve on error
  */
 int env_set_default_vars(int nvars, char *const vars[], int flags);
 
-- 
2.32.0


  parent reply	other threads:[~2021-11-03 23:25 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 23:23 [PATCH v2 00/12] Board specific runtime determined default env Marek Behún
2021-11-03 23:23 ` [PATCH v2 01/12] env: Don't set ready flag if import failed in env_set_default() Marek Behún
2021-11-14  0:34   ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 02/12] env: Fix env_get() when returning empty string using env_get_f() Marek Behún
2021-11-14  0:34   ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 03/12] env: Simplify env_get_default() Marek Behún
2021-11-14  0:34   ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 04/12] sysinfo: Make sysinfo_get_str() behave like snprintf() Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-05 11:19     ` Marek Behún
2021-11-05 16:12       ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 05/12] test: Use ut_asserteq_str() instead of ut_assertok(strcmp()) Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 06/12] sysinfo: Add get_str_list() method Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-05 11:20     ` Marek Behún
2021-11-05 16:12       ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 07/12] sysinfo: Make .detect() non-mandatory Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 08/12] sysinfo: Add support for iterating string list Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-05 11:24     ` Marek Behún
2021-11-05 16:12       ` Simon Glass
2021-11-03 23:23 ` Marek Behún [this message]
2021-11-05  2:02   ` [PATCH v2 09/12] env: Change return behaviour of env_set_default_vars() Simon Glass
2021-11-03 23:23 ` [PATCH v2 10/12] env: Add support for overwriting default environment via sysinfo Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-03 23:23 ` [PATCH v2 11/12] arm: mvebu: Espressobin: Use new API for setting default env at runtime Marek Behún
2021-11-05  2:02   ` Simon Glass
2021-11-05  8:50     ` Pali Rohár
2021-11-09 15:37       ` Pali Rohár
2021-11-03 23:23 ` [PATCH v2 12/12] env: Remove support for read-write default_environment[] Marek Behún
2021-11-05  2:02   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211103232332.2737-10-kabel@kernel.org \
    --to=kabel@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=pali@kernel.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox