* [PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand
@ 2021-12-29 2:50 qianfanguijin
2022-01-27 15:06 ` Simon Glass
2022-01-27 16:56 ` Sean Anderson
0 siblings, 2 replies; 3+ messages in thread
From: qianfanguijin @ 2021-12-29 2:50 UTC (permalink / raw)
To: sean.anderson, u-boot; +Cc: qianfan Zhao
From: qianfan Zhao <qianfanguijin@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@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 */
+ r = -ENODEV;
+ else if (size)
*size = part_info->size;
# else
fastboot_fail("this storage is not supported in bootloader", response);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand
2021-12-29 2:50 [PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand qianfanguijin
@ 2022-01-27 15:06 ` Simon Glass
2022-01-27 16:56 ` Sean Anderson
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-01-27 15:06 UTC (permalink / raw)
To: qianfan; +Cc: Sean Anderson, U-Boot Mailing List, qianfan Zhao
On Tue, 28 Dec 2021 at 19:51, <qianfanguijin@qq.com> wrote:
>
> From: qianfan Zhao <qianfanguijin@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@163.com>
> ---
> drivers/fastboot/fb_getvar.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand
2021-12-29 2:50 [PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand qianfanguijin
2022-01-27 15:06 ` Simon Glass
@ 2022-01-27 16:56 ` Sean Anderson
1 sibling, 0 replies; 3+ messages in thread
From: Sean Anderson @ 2022-01-27 16:56 UTC (permalink / raw)
To: qianfanguijin, u-boot; +Cc: qianfan Zhao
On 12/28/21 9:50 PM, qianfanguijin@qq.com wrote:
> From: qianfan Zhao <qianfanguijin@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@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-27 16:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29 2:50 [PATCH v1] driver: fastboot: Fix getvar_get_part_info when flash nand qianfanguijin
2022-01-27 15:06 ` Simon Glass
2022-01-27 16:56 ` Sean Anderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.