mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-28 09:11:34 +02:00
usb:gadget:f_thor: code cleanup in function download_tail()
In thor's download_tail() function, dfu_get_entity() is called before each dfu_write() call and the returned entity pointers are the same. So dfu_get_entity() can be called just once and this patch changes this. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Tom Rini <trini@ti.com>
This commit is contained in:
parent
08a98b89df
commit
adfc17bf09
@ -204,14 +204,14 @@ static long long int download_head(unsigned long long total,
|
|||||||
|
|
||||||
static int download_tail(long long int left, int cnt)
|
static int download_tail(long long int left, int cnt)
|
||||||
{
|
{
|
||||||
|
struct dfu_entity *dfu_entity = dfu_get_entity(alt_setting_num);
|
||||||
void *transfer_buffer = dfu_get_buf();
|
void *transfer_buffer = dfu_get_buf();
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
debug("%s: left: %llu cnt: %d\n", __func__, left, cnt);
|
debug("%s: left: %llu cnt: %d\n", __func__, left, cnt);
|
||||||
|
|
||||||
if (left) {
|
if (left) {
|
||||||
ret = dfu_write(dfu_get_entity(alt_setting_num),
|
ret = dfu_write(dfu_entity, transfer_buffer, left, cnt++);
|
||||||
transfer_buffer, left, cnt++);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error("DFU write failed [%d]: left: %llu", ret, left);
|
error("DFU write failed [%d]: left: %llu", ret, left);
|
||||||
return ret;
|
return ret;
|
||||||
@ -225,8 +225,7 @@ static int download_tail(long long int left, int cnt)
|
|||||||
* This also frees memory malloc'ed by dfu_get_buf(), so no explicit
|
* This also frees memory malloc'ed by dfu_get_buf(), so no explicit
|
||||||
* need fo call dfu_free_buf() is needed.
|
* need fo call dfu_free_buf() is needed.
|
||||||
*/
|
*/
|
||||||
ret = dfu_write(dfu_get_entity(alt_setting_num),
|
ret = dfu_write(dfu_entity, transfer_buffer, 0, cnt);
|
||||||
transfer_buffer, 0, cnt);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
error("DFU write failed [%d] cnt: %d", ret, cnt);
|
error("DFU write failed [%d] cnt: %d", ret, cnt);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user