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.ha...@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