From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH v2 06/20] fip: use uuid_equal() and uuid_is_null()
Date: Wed, 12 Feb 2025 15:09:19 +0100 [thread overview]
Message-ID: <20250212-k3-emmc-v2-6-8dd1bb0ce60a@pengutronix.de> (raw)
In-Reply-To: <20250212-k3-emmc-v2-0-8dd1bb0ce60a@pengutronix.de>
We have uuid_equal() and uuid_is_null(), use that rather than open coded
memcmp().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
commands/fiptool.c | 10 ++++------
lib/fip.c | 4 ++--
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/commands/fiptool.c b/commands/fiptool.c
index 45d534e470..b917c62a97 100644
--- a/commands/fiptool.c
+++ b/commands/fiptool.c
@@ -219,8 +219,7 @@ static __maybe_unused int create_cmd(struct fip_state *fip, int argc, char *argv
parse_blob_opt(optarg, &uuid,
filename, sizeof(filename));
- if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0 ||
- filename[0] == '\0')
+ if (uuid_is_null(&uuid) || filename[0] == '\0')
return COMMAND_ERROR_USAGE;
desc = lookup_image_desc_from_uuid(fip, &uuid);
@@ -286,7 +285,7 @@ static __maybe_unused int update_cmd(struct fip_state *fip, int argc, char *argv
parse_blob_opt(optarg, &uuid,
filename, sizeof(filename));
- if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0 ||
+ if (uuid_is_null(&uuid) ||
filename[0] == '\0')
return COMMAND_ERROR_USAGE;
@@ -368,8 +367,7 @@ static int unpack_cmd(struct fip_state *fip, int argc, char *argv[])
parse_blob_opt(optarg, &uuid,
filename, sizeof(filename));
- if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0 ||
- filename[0] == '\0')
+ if (uuid_is_null(&uuid) || filename[0] == '\0')
return COMMAND_ERROR_USAGE;
desc = lookup_image_desc_from_uuid(fip, &uuid);
@@ -478,7 +476,7 @@ static __maybe_unused int remove_cmd(struct fip_state *fip, int argc, char *argv
parse_blob_opt(optarg, &uuid,
filename, sizeof(filename));
- if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0)
+ if (uuid_is_null(&uuid))
return COMMAND_ERROR_USAGE;
desc = lookup_image_desc_from_uuid(fip, &uuid);
diff --git a/lib/fip.c b/lib/fip.c
index 63f1469086..774de2ad1d 100644
--- a/lib/fip.c
+++ b/lib/fip.c
@@ -127,7 +127,7 @@ struct fip_image_desc *lookup_image_desc_from_uuid(struct fip_state *fip,
struct fip_image_desc *desc;
fip_for_each_desc(fip, desc)
- if (memcmp(&desc->uuid, uuid, sizeof(uuid_t)) == 0)
+ if (uuid_equal(&desc->uuid, uuid))
return desc;
return NULL;
}
@@ -210,7 +210,7 @@ int parse_fip(struct fip_state *fip,
struct fip_image_desc *desc;
/* Found the ToC terminator, we are done. */
- if (memcmp(&toc_entry->uuid, &uuid_null, sizeof(uuid_t)) == 0) {
+ if (uuid_is_null(&toc_entry->uuid)) {
terminated = 1;
break;
}
--
2.39.5
next prev parent reply other threads:[~2025-02-12 14:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 14:09 [PATCH v2 00/20] ARM: K3 updates Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 01/20] ARM: k3: Add function to enable 32k crystal Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 02/20] ARM: k3: add function to detect eMMC boot Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 03/20] ARM: k3: do not mount /boot when booting from eMMC Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 04/20] fip: drop typedefs Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 05/20] fip: use linux list implementation Sascha Hauer
2025-02-12 14:09 ` Sascha Hauer [this message]
2025-02-12 14:09 ` [PATCH v2 07/20] fiptool: do not typedef structs Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 08/20] fip: add fip_ prefix Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 09/20] fip: add fip_image_open() Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 10/20] ARM: k3: r5: add USB DFU and eMMC boot support Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 11/20] ARM: am625-sk: enable 32k crystal Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 12/20] mci: am654: parse generic mmc node properties Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 13/20] ARM: k3: limit eMMC frequency to 26MHz Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 14/20] ARM: k3: add eMMC barebox update handler Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 15/20] ARM: am625-sk: put environment on eMMC when booting from it Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 16/20] serial: omap: Use ttyS as Linux console name Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 17/20] ARM: k3: remove beagleplay FIT image Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 18/20] ARM: am625-sk: cleanup board entry Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 19/20] ARM: beagleplay: " Sascha Hauer
2025-02-12 14:09 ` [PATCH v2 20/20] ARM: k3: Add k3-r5_defconfig Sascha Hauer
2025-02-17 11:14 ` [PATCH v2 00/20] ARM: K3 updates Sascha Hauer
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=20250212-k3-emmc-v2-6-8dd1bb0ce60a@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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