]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fastboot: properly handle unknown partition type
authorCaleb Connolly <caleb.connolly@linaro.org>
Wed, 13 Nov 2024 05:05:59 +0000 (06:05 +0100)
committerMattijs Korpershoek <mkorpershoek@baylibre.com>
Tue, 19 Nov 2024 14:10:56 +0000 (15:10 +0100)
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>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20241113050607.1850472-1-caleb.connolly@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
drivers/fastboot/fb_getvar.c

index 93cbd598e024fe9a7c4fcbef302534d35da1ad57..9c2ce65a4e5bce0da6b18aa1b2818f7db556c528 100644 (file)
@@ -230,7 +230,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);
        }