mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/3] common: machine_id: simplify early exit
@ 2022-08-08  6:20 Ahmad Fatoum
  2022-08-08  6:20 ` [PATCH master 2/3] common: machine_id: guard against digest algo being unavailable Ahmad Fatoum
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2022-08-08  6:20 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We don't need the goto if we haven't done anything to clean up anyway.
also globalvar_add_simple("machine_id", NULL) is a no-op when we have
just called globalvar_add_simple above with an actual argument.
It doesn't clean the parameter, nor should it, because the code is
executed for the successful code as well and there is nothing that can
fail that late.

No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/machine_id.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/common/machine_id.c b/common/machine_id.c
index 6480806cd287..a530fdeb1da8 100644
--- a/common/machine_id.c
+++ b/common/machine_id.c
@@ -30,11 +30,11 @@ static int machine_id_set_globalvar(void)
 	unsigned char machine_id[SHA1_DIGEST_SIZE];
 	char hex_machine_id[MACHINE_ID_LENGTH];
 	char *env_machine_id;
-	int ret = 0;
+	int ret;
 
 	/* nothing to do if no hashable information provided */
 	if (!__machine_id_hashable)
-		goto out;
+		return 0;
 
 	digest = digest_alloc_by_algo(HASH_ALGO_SHA1);
 	ret = digest_init(digest);
@@ -58,8 +58,6 @@ static int machine_id_set_globalvar(void)
 	free(env_machine_id);
 
 out:
-	globalvar_add_simple("machine_id", NULL);
-
 	digest_free(digest);
 	return ret;
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-09  4:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08  6:20 [PATCH master 1/3] common: machine_id: simplify early exit Ahmad Fatoum
2022-08-08  6:20 ` [PATCH master 2/3] common: machine_id: guard against digest algo being unavailable Ahmad Fatoum
2022-08-08 11:48   ` Sascha Hauer
2022-08-08 11:50     ` Ahmad Fatoum
2022-08-08  6:20 ` [PATCH master 3/3] crypto: restrict digest algos implemented in ARM assembly to 32-bit Ahmad Fatoum
2022-08-08 11:40 ` [PATCH master 1/3] common: machine_id: simplify early exit Sascha Hauer
2022-08-08 11:43   ` Ahmad Fatoum
2022-08-09  4:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox