[PATCH v1] dfu: fix dev_part_str for file operations
Lukasz Majewski
lukma at denx.de
Wed Jun 11 09:14:26 CEST 2025
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 at 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 at 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 at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250611/2524d30a/attachment.sig>
More information about the U-Boot
mailing list