On 12/28/21 9:50 PM, [email protected] wrote:
> From: qianfan Zhao <[email protected]>
> 
> find_dev_and_part return 0 on success, 1 otherwise.
> So fastboot_nand_get_part_info follow this rule.
> 
> Signed-off-by: qianfan Zhao <[email protected]>
> ---
>  drivers/fastboot/fb_getvar.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index d43f2cfee6..a7a8dc458f 100644
> --- a/drivers/fastboot/fb_getvar.c
> +++ b/drivers/fastboot/fb_getvar.c
> @@ -114,7 +114,10 @@ static int getvar_get_part_info(const char *part_name, 
> char *response,
>       struct part_info *part_info;
>  
>       r = fastboot_nand_get_part_info(part_name, &part_info, response);
> -     if (r >= 0 && size)
> +
> +     if (r) /* find nand device and part failed */

One branch does fail with -EINVAL. Can we make this something like

if (r == 1)
        r = -ENODEV;

if (size)
        *size = part_info->size

though even better would be to go and fix mtdparts_init/find_dev_and_part to 
return negative numbers...

--Sean

Reply via email to