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 */
+               r = -ENODEV;
+       else if (size)
                *size = part_info->size;
 # else
        fastboot_fail("this storage is not supported in bootloader", response);
-- 
2.17.1

Reply via email to