[U-Boot] [PATCH v2] fastboot: Improve error reporting on 'getvar partition-{size, type}'

Eugeniu Rosca erosca at de.adit-jv.com
Thu Mar 28 13:31:33 UTC 2019


Currently U-Boot reports the same error message in all below cases:
[A] host> fastboot getvar partition-type
[B] host> fastboot getvar partition-size
[C] host> fastboot getvar partition-type:
[D] host> fastboot getvar partition-size:
[E] host> fastboot getvar partition-type:<invalid-part>
[F] host> fastboot getvar partition-size:<invalid-part>

The message looks like:
host> fastboot getvar partition-size:
getvar:partition-size: FAILED (remote: partition not found)
Finished. Total time: 0.003s

Be more user friendly and output:
 - "partition not given" for [A-D]
 - "partition not found" for [E-F]

Fixes: f73a7df984a9 ("net: fastboot: Merge AOSP UDP fastboot")
Signed-off-by: Eugeniu Rosca <erosca at de.adit-jv.com>
---

v2:
 - Link v1: https://patchwork.ozlabs.org/patch/1058755/
 - Benefit from the existing error strings rather than bloating the
   code with new ones.
---
 drivers/fastboot/fb_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 4c1c7fd2cd8d..d04d8a448ccf 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -308,8 +308,8 @@ int fastboot_mmc_get_part_info(char *part_name, struct blk_desc **dev_desc,
 		fastboot_fail("block device not found", response);
 		return -ENOENT;
 	}
-	if (!part_name) {
-		fastboot_fail("partition not found", response);
+	if (!part_name || !strcmp(part_name, "")) {
+		fastboot_fail("partition not given", response);
 		return -ENOENT;
 	}
 
-- 
2.21.0



More information about the U-Boot mailing list