diff options
author | Lukasz Majewski <l.majewski@samsung.com> | 2016-05-12 13:25:43 +0200 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2016-05-18 15:39:48 +0900 |
commit | 2d5d9503b2fe7faef247b77b6e2d9e6c0ef890e4 (patch) | |
tree | 10e9e7ccb4e00af930177a1f22d9fffa096713ff | |
parent | a1d2b2b46da11d17572d33870d52adeb6b86c0d7 (diff) | |
download | u-boot-2d5d9503b2fe7faef247b77b6e2d9e6c0ef890e4.tar.gz u-boot-2d5d9503b2fe7faef247b77b6e2d9e6c0ef890e4.tar.bz2 u-boot-2d5d9503b2fe7faef247b77b6e2d9e6c0ef890e4.zip |
TPL: TM2: f_thor: Allow to download 4GB images
This commit fixes 2GB file size limit for thor downloader.
The application on host side sends the downloaded file size as 32-bit
unsigned value. But the thor implementation on U-Boot side interpreted
this as signed value. This caused an error for files with size greater
than 2GB.
This commit fixes the data types in code, which allows to send file
of size 4GB.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
[m.szyprowski: ported from tizen.org and fixed 64bit issues]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r-- | drivers/usb/gadget/f_thor.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 08725d6932..7d9fbfdf70 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -175,7 +175,7 @@ static int download_head(unsigned long long total, if (ret < 0) return ret; rcv_cnt += ret_rcv; - debug("%d: RCV data count: %u cnt: %d\n", usb_pkt_cnt, + debug("%d: RCV data count: %zu cnt: %d\n", usb_pkt_cnt, rcv_cnt, *cnt); if ((rcv_cnt % THOR_STORE_UNIT_SIZE) == 0) { @@ -200,7 +200,7 @@ static int download_head(unsigned long long total, * on the medium (they are smaller than THOR_STORE_UNIT_SIZE) */ *left = left_to_rcv + buf - transfer_buffer; - debug("%s: left: %u left_to_rcv: %u buf: 0x%p\n", __func__, + debug("%s: left: %zu left_to_rcv: %zu buf: 0x%p\n", __func__, *left, left_to_rcv, buf); if (left_to_rcv) { @@ -212,7 +212,7 @@ static int download_head(unsigned long long total, send_data_rsp(0, ++usb_pkt_cnt); } - debug("%s: %u total: %llu cnt: %d\n", __func__, rcv_cnt, total, *cnt); + debug("%s: %zu total: %llu cnt: %d\n", __func__, rcv_cnt, total, *cnt); return 0; } @@ -285,7 +285,7 @@ static int process_rqt_download(const struct rqt_box *rqt) total_file_size = thor_file_size; downloaded_file_size = 0; #endif - debug("INIT: total %u bytes\n", (size_t)rqt->int_data[0]); + debug("INIT: total %zu bytes\n", (size_t)rqt->int_data[0]); break; case RQT_DL_FILE_INFO: file_type = rqt->int_data[0]; @@ -299,7 +299,7 @@ static int process_rqt_download(const struct rqt_box *rqt) thor_file_size = (size_t)rqt->int_data[1]; memcpy(f_name, rqt->str_data[0], F_NAME_BUF_SIZE); - debug("INFO: name(%s, %d), size(%u), type(%d)\n", + debug("INFO: name(%s, %d), size(%zu), type(%d)\n", f_name, 0, thor_file_size, file_type); rsp->int_data[0] = THOR_PACKET_SIZE; |