[PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand
Sean Anderson
sean.anderson at seco.com
Thu Jan 27 17:56:10 CET 2022
On 12/28/21 9:50 PM, qianfanguijin at qq.com wrote:
> From: qianfan Zhao <qianfanguijin at 163.com>
>
> find_dev_and_part return 0 on success, 1 otherwise.
> So fastboot_nand_get_part_info follow this rule.
>
> Signed-off-by: qianfan Zhao <qianfanguijin at 163.com>
> ---
> 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
More information about the U-Boot
mailing list