dfu: fix dev_part_str for file operations

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>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Link: https://lore.kernel.org/r/20250611050127.38011-1-ipman@amazon.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
This commit is contained in:
Ivan Pang
2025-06-11 05:00:38 +00:00
committed by Mattijs Korpershoek
parent c5afa1fef4
commit aa2efc584a
2 changed files with 2 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
return -1; 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); dfu->data.mmc.dev, dfu->data.mmc.part);
ret = fs_set_blk_dev("mmc", dev_part_str, fstype); ret = fs_set_blk_dev("mmc", dev_part_str, fstype);

View File

@@ -96,7 +96,7 @@ static int scsi_file_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void
return -1; 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); dfu->data.scsi.part);
ret = fs_set_blk_dev("scsi", dev_part_str, fstype); ret = fs_set_blk_dev("scsi", dev_part_str, fstype);