All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fastboot: properly handle unknown partition type
@ 2024-11-13  5:05 Caleb Connolly
  2024-11-14 13:25 ` Mattijs Korpershoek
  2024-11-19 14:11 ` Mattijs Korpershoek
  0 siblings, 2 replies; 3+ messages in thread
From: Caleb Connolly @ 2024-11-13  5:05 UTC (permalink / raw)
  To: Caleb Connolly, Ion Agorria, Mattijs Korpershoek,
	Svyatoslav Ryhel, Tom Rini
  Cc: u-boot

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>
---
 drivers/fastboot/fb_getvar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index 93cbd598e024..9c2ce65a4e5b 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -229,9 +229,10 @@ static void __maybe_unused getvar_partition_type(char *part_name, char *response
 				       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);
 	}
 }
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fastboot: properly handle unknown partition type
  2024-11-13  5:05 [PATCH] fastboot: properly handle unknown partition type Caleb Connolly
@ 2024-11-14 13:25 ` Mattijs Korpershoek
  2024-11-19 14:11 ` Mattijs Korpershoek
  1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2024-11-14 13:25 UTC (permalink / raw)
  To: Caleb Connolly, Caleb Connolly, Ion Agorria, Svyatoslav Ryhel,
	Tom Rini
  Cc: u-boot

Hi Caleb,

Thank you for the patch.

On mer., nov. 13, 2024 at 06:05, Caleb Connolly <caleb.connolly@linaro.org> wrote:

> 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>

> ---
>  drivers/fastboot/fb_getvar.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index 93cbd598e024..9c2ce65a4e5b 100644
> --- a/drivers/fastboot/fb_getvar.c
> +++ b/drivers/fastboot/fb_getvar.c
> @@ -229,9 +229,10 @@ static void __maybe_unused getvar_partition_type(char *part_name, char *response
>  				       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);
>  	}
>  }
> -- 
> 2.47.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fastboot: properly handle unknown partition type
  2024-11-13  5:05 [PATCH] fastboot: properly handle unknown partition type Caleb Connolly
  2024-11-14 13:25 ` Mattijs Korpershoek
@ 2024-11-19 14:11 ` Mattijs Korpershoek
  1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2024-11-19 14:11 UTC (permalink / raw)
  To: Ion Agorria, Svyatoslav Ryhel, Tom Rini, Caleb Connolly; +Cc: u-boot

Hi,

On Wed, 13 Nov 2024 06:05:59 +0100, Caleb Connolly wrote:
> 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.
> 
> [...]

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)

[1/1] fastboot: properly handle unknown partition type
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/06b8aafd6810d86f37d5b1cd9c1966f1e42403ed

--
Mattijs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-19 14:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13  5:05 [PATCH] fastboot: properly handle unknown partition type Caleb Connolly
2024-11-14 13:25 ` Mattijs Korpershoek
2024-11-19 14:11 ` Mattijs Korpershoek

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.