diff mbox series

mtd: errno of missing volume has changed

Message ID 20180417153301.32313-1-arnout@mind.be
State Accepted
Headers show
Series mtd: errno of missing volume has changed | expand

Commit Message

Arnout Vandecappelle April 17, 2018, 3:33 p.m. UTC
Since commit dede98ffb706676309488d7cc660f569548d5930 of mtd-utils, the
errno set for a missing volume in ubi_get_vol_info1() has changed from
ENOENT to ENODEV.

Since we don't know which version of libmtd is used, check for both.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 corelib/mtd-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic April 18, 2018, 12:25 p.m. UTC | #1
On 17/04/2018 17:33, Arnout Vandecappelle (Essensium/Mind) wrote:
> Since commit dede98ffb706676309488d7cc660f569548d5930 of mtd-utils, the
> errno set for a missing volume in ubi_get_vol_info1() has changed from
> ENOENT to ENODEV.

Thanks, I was not aware of this.

> 
> Since we don't know which version of libmtd is used, check for both.

Agree.

> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  corelib/mtd-interface.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/corelib/mtd-interface.c b/corelib/mtd-interface.c
> index d5c4f3f..cd85007 100644
> --- a/corelib/mtd-interface.c
> +++ b/corelib/mtd-interface.c
> @@ -259,7 +259,7 @@ static void scan_ubi_volumes(struct mtd_ubi_info *info)
>  		err = ubi_get_vol_info1(libubi, info->dev_info.dev_num,
>  					i, &ubi_part->vol_info);
>  		if (err == -1) {
> -			if (errno == ENOENT)
> +			if (errno == ENOENT || errno == ENODEV)
>  				continue;
>  
>  			ERROR("libubi failed to probe volume %d on ubi%d",
> 

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

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/mtd-interface.c b/corelib/mtd-interface.c
index d5c4f3f..cd85007 100644
--- a/corelib/mtd-interface.c
+++ b/corelib/mtd-interface.c
@@ -259,7 +259,7 @@  static void scan_ubi_volumes(struct mtd_ubi_info *info)
 		err = ubi_get_vol_info1(libubi, info->dev_info.dev_num,
 					i, &ubi_part->vol_info);
 		if (err == -1) {
-			if (errno == ENOENT)
+			if (errno == ENOENT || errno == ENODEV)
 				continue;
 
 			ERROR("libubi failed to probe volume %d on ubi%d",