summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Connolly <caleb.connolly@linaro.org>2023-12-12 13:24:08 +0000
committerCaleb Connolly <caleb.connolly@linaro.org>2023-12-12 13:24:08 +0000
commitd99586b6329922d714fc0ee97465b43bb423615a (patch)
treef03ca12f848ffa2d49512d69d2bada01ad7d5bab
parent00bd731671c00306c13fe642a75c4f67a07be386 (diff)
fastboot: properly handle unknown partition type
In getvar_partition_type() we attempt to find a filesystem driver for the partition (of the list of driver enabled in U-Boot), on failure we return the error to fastboot and completely bail out of the operation. However, this should not be a failure, instead we should just default to "raw". This allows commands like "fastboot format:ext4 userdata" to work if userdata didn't already have an ext4 partition table (or if FS_EXT4 is disabled in U-Boot), as failing to determine the current partition type is not an error in this case. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
-rw-r--r--drivers/fastboot/fb_getvar.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index 8cb8ffa2c6..bc395652bb 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -216,7 +216,8 @@ static void __maybe_unused getvar_partition_type(char *part_name, char *response
if (r >= 0) {
r = fs_set_blk_dev_with_part(dev_desc, r);
if (r < 0)
- fastboot_fail("failed to set partition", response);
+ /* If we don't know then just default to raw */
+ fastboot_okay("raw", response);
else
fastboot_okay(fs_get_type_name(), response);
}