diff mbox series

avb: Fix error when partition not found

Message ID 20210225161910.68035-1-schspa@gmail.com
State Accepted
Commit 0453411998ed4425c5c1543de53ff7474bd42eea
Delegated to: Tom Rini
Headers show
Series avb: Fix error when partition not found | expand

Commit Message

Shi Schspa Feb. 25, 2021, 4:19 p.m. UTC
part_get_info_by_name will return -1 on error, and >0 on success.

Signed-off-by: schspa <schspa@gmail.com>
Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
---
 common/avb_verify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Igor Opaniuk Feb. 26, 2021, 8:49 a.m. UTC | #1
Hi schspa,

On Thu, Feb 25, 2021 at 6:25 PM schspa <schspa@gmail.com> wrote:
>
> part_get_info_by_name will return -1 on error, and >0 on success.
>
> Signed-off-by: schspa <schspa@gmail.com>
> Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
> ---
>  common/avb_verify.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/avb_verify.c b/common/avb_verify.c
> index db10d0f21f..0520a71455 100644
> --- a/common/avb_verify.c
> +++ b/common/avb_verify.c
> @@ -369,7 +369,7 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition)
>         }
>
>         ret = part_get_info_by_name(mmc_blk, partition, &part->info);
> -       if (!ret) {
> +       if (ret < 0) {
>                 printf("Can't find partition '%s'\n", partition);
>                 goto err;
>         }
> --
> 2.24.3 (Apple Git-128)
>

Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Tom Rini March 18, 2021, 4:56 p.m. UTC | #2
On Fri, Feb 26, 2021 at 12:19:10AM +0800, schspa wrote:

> part_get_info_by_name will return -1 on error, and >0 on success.
> 
> Signed-off-by: schspa <schspa@gmail.com>
> Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/avb_verify.c b/common/avb_verify.c
index db10d0f21f..0520a71455 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -369,7 +369,7 @@  static struct mmc_part *get_partition(AvbOps *ops, const char *partition)
 	}
 
 	ret = part_get_info_by_name(mmc_blk, partition, &part->info);
-	if (!ret) {
+	if (ret < 0) {
 		printf("Can't find partition '%s'\n", partition);
 		goto err;
 	}