dfu: fix dev_part_str for file operations
PATCH 1/1 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.
---
drivers/dfu/dfu_mmc.c | 2 +- drivers/dfu/dfu_scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/dfu/dfu_mmc.c +1 -1
@@ -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);
drivers/dfu/dfu_scsi.c +1 -1
@@ -96,7 +96,7 @@ static int scsi_file_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, voidreturn -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);
Signature · 1 line
2.47.1
Hi Ivan,
Quoted 39 lines
The
third_argfor a dfu alt is read as an integer and is overloaded for different supported backends. For ext4 and fat, thisthird_argrepresents 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 <[email protected]>---
drivers/dfu/dfu_mmc.c | 2 +- drivers/dfu/dfu_scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/dfu/dfu_mmc.c +1
-1@@ -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);drivers/dfu/dfu_scsi.c +1
-1@@ -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);
Quoted 1 line
ret =
fs_set_blk_dev("scsi", dev_part_str, fstype);
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: [email protected]
Hi Ivan,
Thank you for the patch, nice catch!
Quoted 7 lines · Ivan Pang
The
third_argfor a dfu alt is read as an integer and is overloaded for different supported backends. For ext4 and fat, thisthird_argrepresents 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 <[email protected]>
Quoted 34 lines
---
drivers/dfu/dfu_mmc.c | 2 +- drivers/dfu/dfu_scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/dfu/dfu_mmc.c +1
-1@@ -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);drivers/dfu/dfu_scsi.c +1
-1@@ -96,7 +96,7 @@ static int scsi_file_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, voidreturn -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);Signature · 1 line
2.47.1
Hi,
Quoted 8 lines · Ivan Pang
The
third_argfor a dfu alt is read as an integer and is overloaded for different supported backends. For ext4 and fat, thisthird_argrepresents 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