mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Cc: anis chali <chalianis1@gmail.com>
Subject: Re: [PATCH] FIT: let fit_has_image() return bool
Date: Thu, 4 Sep 2025 08:59:16 +0200	[thread overview]
Message-ID: <d2679421-b69b-49aa-ad58-23ab81e39ed2@pengutronix.de> (raw)
In-Reply-To: <20250904055336.3136705-1-s.hauer@pengutronix.de>

On 04.09.25 07:53, Sascha Hauer wrote:
> 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>

Reviewed-by: Ahmad Fatoum <a.fatoum@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);


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2025-09-04  6:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  5:53 Sascha Hauer
2025-09-04  6:59 ` Ahmad Fatoum [this message]
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=d2679421-b69b-49aa-ad58-23ab81e39ed2@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=chalianis1@gmail.com \
    --cc=s.hauer@pengutronix.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