[PATCH] ffu: Fix usage of sect_size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Read firmware image in chunch of sect_size bytes, to support non 512B
sector size.

Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
---
 mmc_cmds.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mmc_cmds.c b/mmc_cmds.c
index 44623fe..cf59edf 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -2427,7 +2427,7 @@ int do_ffu(int nargs, char **argv)
 		exit(1);
 	}
 
-	buf = malloc(512);
+	buf = malloc(4096);
 	multi_cmd = calloc(1, sizeof(struct mmc_ioc_multi_cmd) +
 				3 * sizeof(struct mmc_ioc_cmd));
 	if (!buf || !multi_cmd) {
@@ -2510,7 +2510,7 @@ int do_ffu(int nargs, char **argv)
 do_retry:
 	/* read firmware chunk */
 	lseek(img_fd, 0, SEEK_SET);
-	chunk_size = read(img_fd, buf, 512);
+	chunk_size = read(img_fd, buf, sect_size);
 
 	while (chunk_size > 0) {
 		/* send ioctl with multi-cmd */
@@ -2548,7 +2548,7 @@ do_retry:
 		}
 
 		/* read the next firmware chunk (if any) */
-		chunk_size = read(img_fd, buf, 512);
+		chunk_size = read(img_fd, buf, sect_size);
 	}
 
 	if ((sect_done * sect_size) == fw_size) {
-- 
2.18.0.rc2.346.g013aa6912e-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux