diff options
author | Tom Rini <trini@konsulko.com> | 2022-01-28 12:13:23 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-01-28 12:13:23 -0500 |
commit | 2d0953c0e0de02dc470345c2b07d77d2a782dba6 (patch) | |
tree | 9e15e28efddfbbb0c2cad90aefd6affca0074a36 | |
parent | 761a1786e125ce0e2f472f25f2b841d5f4e2f0cb (diff) | |
parent | 7e90f771730001f9ba749985f81103930e892eaf (diff) | |
download | u-boot-2d0953c0e0de02dc470345c2b07d77d2a782dba6.zip u-boot-2d0953c0e0de02dc470345c2b07d77d2a782dba6.tar.gz u-boot-2d0953c0e0de02dc470345c2b07d77d2a782dba6.tar.bz2 |
Merge branch '2022-01-28-fastboot-updates'
- 3 DFU/fastboot bugfixes
-rw-r--r-- | drivers/fastboot/fb_common.c | 2 | ||||
-rw-r--r-- | drivers/fastboot/fb_mmc.c | 29 | ||||
-rw-r--r-- | drivers/usb/gadget/f_dfu.c | 2 |
3 files changed, 15 insertions, 18 deletions
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c index cbcc368..ef399d0 100644 --- a/drivers/fastboot/fb_common.c +++ b/drivers/fastboot/fb_common.c @@ -91,7 +91,7 @@ void fastboot_okay(const char *reason, char *response) */ int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) { -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC_DEV) +#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV static const char * const boot_cmds[] = { [FASTBOOT_REBOOT_REASON_BOOTLOADER] = "bootonce-bootloader", [FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot", diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c index 2710879..c62e414 100644 --- a/drivers/fastboot/fb_mmc.c +++ b/drivers/fastboot/fb_mmc.c @@ -104,23 +104,18 @@ static int part_get_info_by_name_or_alias(struct blk_desc **dev_desc, const char *name, struct disk_partition *info) { - int ret; - - ret = do_get_part_info(dev_desc, name, info); - if (ret < 0) { - /* strlen("fastboot_partition_alias_") + PART_NAME_LEN + 1 */ - char env_alias_name[25 + PART_NAME_LEN + 1]; - char *aliased_part_name; - - /* check for alias */ - strcpy(env_alias_name, "fastboot_partition_alias_"); - strlcat(env_alias_name, name, sizeof(env_alias_name)); - aliased_part_name = env_get(env_alias_name); - if (aliased_part_name != NULL) - ret = do_get_part_info(dev_desc, aliased_part_name, - info); - } - return ret; + /* strlen("fastboot_partition_alias_") + PART_NAME_LEN + 1 */ + char env_alias_name[25 + PART_NAME_LEN + 1]; + char *aliased_part_name; + + /* check for alias */ + strlcpy(env_alias_name, "fastboot_partition_alias_", sizeof(env_alias_name)); + strlcat(env_alias_name, name, sizeof(env_alias_name)); + aliased_part_name = env_get(env_alias_name); + if (aliased_part_name) + name = aliased_part_name; + + return do_get_part_info(dev_desc, name, info); } /** diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c index 4bedc7d..e9340ff 100644 --- a/drivers/usb/gadget/f_dfu.c +++ b/drivers/usb/gadget/f_dfu.c @@ -336,6 +336,8 @@ static int state_dfu_idle(struct f_dfu *f_dfu, f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE; f_dfu->blk_seq_num = 0; value = handle_upload(req, len); + if (value >= 0 && value < len) + f_dfu->dfu_state = DFU_STATE_dfuIDLE; break; case USB_REQ_DFU_ABORT: /* no zlp? */ |