Skip to content

Commit f9d69c3

Browse files
de-nordiccarlescufi
authored andcommitted
mgmt/mcumgr/lib: Remove dead code from img_mgmt_upload
The img_mgmt_impl_erase_if_needed was only called when CONFIG_IMG_ERASE_PROGRESSIVELY is y, and it does nothing anyway; because the function always returns 0, and does nothing, neither the function no result processing, from a call to the function, is needed. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 492e2ed commit f9d69c3

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/img_mgmt.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,6 @@ img_mgmt_upload(struct mgmt_ctxt *ctxt)
443443

444444
/* Write the image data to flash. */
445445
if (req.img_data.len != 0) {
446-
#if CONFIG_IMG_ERASE_PROGRESSIVELY
447-
/* erase as we cross sector boundaries */
448-
if (img_mgmt_impl_erase_if_needed(req.off, action.write_bytes) != 0) {
449-
rc = MGMT_ERR_EUNKNOWN;
450-
IMG_MGMT_UPLOAD_ACTION_SET_RC_RSN(&action,
451-
img_mgmt_err_str_flash_erase_failed);
452-
goto end;
453-
}
454-
#endif
455446
/* If this is the last chunk */
456447
if (g_img_mgmt_state.off + req.img_data.len == g_img_mgmt_state.size) {
457448
last = true;

subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src/zephyr_img_mgmt.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,6 @@ img_mgmt_impl_erase_image_data(unsigned int off, unsigned int num_bytes)
463463
return rc;
464464
}
465465

466-
#if CONFIG_IMG_ERASE_PROGRESSIVELY
467-
int img_mgmt_impl_erase_if_needed(uint32_t off, uint32_t len)
468-
{
469-
/* This is done internally to the flash_img API. */
470-
return 0;
471-
}
472-
#endif
473-
474466
int
475467
img_mgmt_impl_swap_type(int slot)
476468
{

0 commit comments

Comments
 (0)