diff mbox series

[4/4] parser: check_missing_hash: use flag NO_DATA_HANDLER

Message ID 1563204929-2762-5-git-send-email-philippe.reynes@softathome.com
State Accepted
Headers show
Series handlers: add a flag NO_DATA_HANDLER | expand

Commit Message

Philippe REYNES July 15, 2019, 3:35 p.m. UTC
This commit clean the code of function check_missing_hash,
instead of comparing the name with strcmp, we simply check
the flag NO_DATA_HANDLER.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
 core/parser.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Stefano Babic July 16, 2019, 2:33 p.m. UTC | #1
On 15/07/19 17:35, Philippe Reynes wrote:
> This commit clean the code of function check_missing_hash,
> instead of comparing the name with strcmp, we simply check
> the flag NO_DATA_HANDLER.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
> ---
>  core/parser.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/core/parser.c b/core/parser.c
> index 62a1cfb..74b6a74 100644
> --- a/core/parser.c
> +++ b/core/parser.c
> @@ -68,11 +68,10 @@ static int check_missing_hash(struct imglist *list)
>  
>  	LIST_FOREACH(image, list, next) {
>  		/*
> -		 * Skip "ubipartition" and "ubiswap" because there is no image
> +		 * Skip handler with no data because there is no image
>  		 * associated for this type
>  		 */
> -		if ( (strcmp(image->type, "ubipartition")) &&
> -		     (strcmp(image->type, "ubiswap")) &&
> +		if ( !(get_handler_mask(image) & NO_DATA_HANDLER) &&
>  				(!IsValidHash(image->sha256))) {
>  			ERROR("Hash not set for %s Type %s",
>  				image->fname,
> 

I apply the series, too.

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/core/parser.c b/core/parser.c
index 62a1cfb..74b6a74 100644
--- a/core/parser.c
+++ b/core/parser.c
@@ -68,11 +68,10 @@  static int check_missing_hash(struct imglist *list)
 
 	LIST_FOREACH(image, list, next) {
 		/*
-		 * Skip "ubipartition" and "ubiswap" because there is no image
+		 * Skip handler with no data because there is no image
 		 * associated for this type
 		 */
-		if ( (strcmp(image->type, "ubipartition")) &&
-		     (strcmp(image->type, "ubiswap")) &&
+		if ( !(get_handler_mask(image) & NO_DATA_HANDLER) &&
 				(!IsValidHash(image->sha256))) {
 			ERROR("Hash not set for %s Type %s",
 				image->fname,