From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: anis chali <chalianis1@gmail.com>
Subject: [PATCH] FIT: let fit_has_image() return bool
Date: Thu, 4 Sep 2025 07:53:36 +0200 [thread overview]
Message-ID: <20250904055336.3136705-1-s.hauer@pengutronix.de> (raw)
The return value of fit_has_image() is treated as bool by most callers.
It could return an error code though which by the callers would be
evaluated to true. Change the return type to bool and return false
instead of an error code to meet the callers expectations.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/image-fit.c | 10 +++++-----
include/image-fit.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/common/image-fit.c b/common/image-fit.c
index 6d241338e4..6b44a79e9d 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -491,19 +491,19 @@ static int fit_image_verify_signature(struct fit_handle *handle,
return ret;
}
-int fit_has_image(struct fit_handle *handle, void *configuration,
- const char *name)
+bool fit_has_image(struct fit_handle *handle, void *configuration,
+ const char *name)
{
const char *unit;
struct device_node *conf_node = configuration;
if (!conf_node)
- return -EINVAL;
+ return false;
if (of_property_read_string(conf_node, name, &unit))
- return 0;
+ return false;
- return 1;
+ return true;
}
static int fit_get_address(struct device_node *image, const char *property,
diff --git a/include/image-fit.h b/include/image-fit.h
index f9791ff251..c332f77bd3 100644
--- a/include/image-fit.h
+++ b/include/image-fit.h
@@ -34,8 +34,8 @@ struct fit_handle *fit_open_buf(const void *buf, size_t len, bool verbose,
void *fit_open_configuration(struct fit_handle *handle, const char *name,
bool (*match_valid)(struct fit_handle *handle,
struct device_node *config));
-int fit_has_image(struct fit_handle *handle, void *configuration,
- const char *name);
+bool fit_has_image(struct fit_handle *handle, void *configuration,
+ const char *name);
int fit_open_image(struct fit_handle *handle, void *configuration,
const char *name, const void **outdata,
unsigned long *outsize);
--
2.47.2
next reply other threads:[~2025-09-04 5:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-04 5:53 Sascha Hauer [this message]
2025-09-04 6:59 ` Ahmad Fatoum
2025-09-04 8:11 ` 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=20250904055336.3136705-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=chalianis1@gmail.com \
/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