All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] dfu: fix dev_part_str for file operations
@ 2025-06-11  5:00 Ivan Pang
  2025-06-11  7:14 ` Lukasz Majewski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ivan Pang @ 2025-06-11  5:00 UTC (permalink / raw)
  To: Lukasz Majewski, Mattijs Korpershoek
  Cc: Ivan Pang, Casey Connolly, Marek Vasut, Rasmus Villemoes,
	Tom Rini, u-boot

The third_arg for a dfu alt is read as an integer and is overloaded for
different supported backends. For ext4 and fat, this third_arg
represents the partition and forms the dev part string, which should
have its partition in hex. This commit fixes dfu ext4/fat usage for
devices with ten or more partitions.

Signed-off-by: Ivan Pang <ipman@amazon.com>
---

 drivers/dfu/dfu_mmc.c  | 2 +-
 drivers/dfu/dfu_scsi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index c19eb919388..a91671755e1 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -117,7 +117,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
 		return -1;
 	}
 
-	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d",
+	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%x",
 		 dfu->data.mmc.dev, dfu->data.mmc.part);
 
 	ret = fs_set_blk_dev("mmc", dev_part_str, fstype);
diff --git a/drivers/dfu/dfu_scsi.c b/drivers/dfu/dfu_scsi.c
index 9f95194784c..7ec34a8f7e3 100644
--- a/drivers/dfu/dfu_scsi.c
+++ b/drivers/dfu/dfu_scsi.c
@@ -96,7 +96,7 @@ static int scsi_file_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void
 		return -1;
 	}
 
-	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d", dfu->data.scsi.dev,
+	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%x", dfu->data.scsi.dev,
 		 dfu->data.scsi.part);
 
 	ret = fs_set_blk_dev("scsi", dev_part_str, fstype);
-- 
2.47.1


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

* Re: [PATCH v1] dfu: fix dev_part_str for file operations
  2025-06-11  5:00 [PATCH v1] dfu: fix dev_part_str for file operations Ivan Pang
@ 2025-06-11  7:14 ` Lukasz Majewski
  2025-06-13  9:57 ` Mattijs Korpershoek
  2025-06-16  7:00 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2025-06-11  7:14 UTC (permalink / raw)
  To: Ivan Pang
  Cc: Mattijs Korpershoek, Casey Connolly, Marek Vasut,
	Rasmus Villemoes, Tom Rini, u-boot

[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]

Hi Ivan,

> The third_arg for a dfu alt is read as an integer and is overloaded
> for different supported backends. For ext4 and fat, this third_arg
> represents the partition and forms the dev part string, which should
> have its partition in hex. This commit fixes dfu ext4/fat usage for
> devices with ten or more partitions.
> 
> Signed-off-by: Ivan Pang <ipman@amazon.com>
> ---
> 
>  drivers/dfu/dfu_mmc.c  | 2 +-
>  drivers/dfu/dfu_scsi.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
> index c19eb919388..a91671755e1 100644
> --- a/drivers/dfu/dfu_mmc.c
> +++ b/drivers/dfu/dfu_mmc.c
> @@ -117,7 +117,7 @@ static int mmc_file_op(enum dfu_op op, struct
> dfu_entity *dfu, return -1;
>  	}
>  
> -	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d",
> +	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%x",
>  		 dfu->data.mmc.dev, dfu->data.mmc.part);
>  
>  	ret = fs_set_blk_dev("mmc", dev_part_str, fstype);
> diff --git a/drivers/dfu/dfu_scsi.c b/drivers/dfu/dfu_scsi.c
> index 9f95194784c..7ec34a8f7e3 100644
> --- a/drivers/dfu/dfu_scsi.c
> +++ b/drivers/dfu/dfu_scsi.c
> @@ -96,7 +96,7 @@ static int scsi_file_op(enum dfu_op op, struct
> dfu_entity *dfu, u64 offset, void return -1;
>  	}
>  
> -	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d",
> dfu->data.scsi.dev,
> +	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%x",
> dfu->data.scsi.dev, dfu->data.scsi.part);
>  
>  	ret = fs_set_blk_dev("scsi", dev_part_str, fstype);

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] dfu: fix dev_part_str for file operations
  2025-06-11  5:00 [PATCH v1] dfu: fix dev_part_str for file operations Ivan Pang
  2025-06-11  7:14 ` Lukasz Majewski
@ 2025-06-13  9:57 ` Mattijs Korpershoek
  2025-06-16  7:00 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2025-06-13  9:57 UTC (permalink / raw)
  To: Ivan Pang, Lukasz Majewski, Mattijs Korpershoek
  Cc: Ivan Pang, Casey Connolly, Marek Vasut, Rasmus Villemoes,
	Tom Rini, u-boot

Hi Ivan,

Thank you for the patch, nice catch!

On Wed, Jun 11, 2025 at 05:00, Ivan Pang <ipman@amazon.com> wrote:

> The third_arg for a dfu alt is read as an integer and is overloaded for
> different supported backends. For ext4 and fat, this third_arg
> represents the partition and forms the dev part string, which should
> have its partition in hex. This commit fixes dfu ext4/fat usage for
> devices with ten or more partitions.
>
> Signed-off-by: Ivan Pang <ipman@amazon.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

> ---
>
>  drivers/dfu/dfu_mmc.c  | 2 +-
>  drivers/dfu/dfu_scsi.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
> index c19eb919388..a91671755e1 100644
> --- a/drivers/dfu/dfu_mmc.c
> +++ b/drivers/dfu/dfu_mmc.c
> @@ -117,7 +117,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
>  		return -1;
>  	}
>  
> -	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d",
> +	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%x",
>  		 dfu->data.mmc.dev, dfu->data.mmc.part);
>  
>  	ret = fs_set_blk_dev("mmc", dev_part_str, fstype);
> diff --git a/drivers/dfu/dfu_scsi.c b/drivers/dfu/dfu_scsi.c
> index 9f95194784c..7ec34a8f7e3 100644
> --- a/drivers/dfu/dfu_scsi.c
> +++ b/drivers/dfu/dfu_scsi.c
> @@ -96,7 +96,7 @@ static int scsi_file_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void
>  		return -1;
>  	}
>  
> -	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d", dfu->data.scsi.dev,
> +	snprintf(dev_part_str, sizeof(dev_part_str), "%d:%x", dfu->data.scsi.dev,
>  		 dfu->data.scsi.part);
>  
>  	ret = fs_set_blk_dev("scsi", dev_part_str, fstype);
> -- 
> 2.47.1

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

* Re: [PATCH v1] dfu: fix dev_part_str for file operations
  2025-06-11  5:00 [PATCH v1] dfu: fix dev_part_str for file operations Ivan Pang
  2025-06-11  7:14 ` Lukasz Majewski
  2025-06-13  9:57 ` Mattijs Korpershoek
@ 2025-06-16  7:00 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2025-06-16  7:00 UTC (permalink / raw)
  To: Lukasz Majewski, Ivan Pang
  Cc: Casey Connolly, Marek Vasut, Rasmus Villemoes, Tom Rini, u-boot

Hi,

On Wed, 11 Jun 2025 05:00:38 +0000, Ivan Pang wrote:
> The third_arg for a dfu alt is read as an integer and is overloaded for
> different supported backends. For ext4 and fat, this third_arg
> represents the partition and forms the dev part string, which should
> have its partition in hex. This commit fixes dfu ext4/fat usage for
> devices with ten or more partitions.
> 
> 
> [...]

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

[1/1] dfu: fix dev_part_str for file operations
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/aa2efc584a4d3fe0fe88cd600f53464b26bcd848

--
Mattijs

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

end of thread, other threads:[~2025-06-16  7:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11  5:00 [PATCH v1] dfu: fix dev_part_str for file operations Ivan Pang
2025-06-11  7:14 ` Lukasz Majewski
2025-06-13  9:57 ` Mattijs Korpershoek
2025-06-16  7:00 ` 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.