Skip to content

Commit 3d8960f

Browse files
de-nordiccarlescufi
authored andcommitted
mgmt/mcumgr/lib: Remove redundant offset check
The offset is checked, for correctness, before the function img_mgmt_impl_write_image_data is called, so it is redundant to do the same check within it. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 4d7d784 commit 3d8960f

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,6 @@ img_mgmt_impl_write_image_data(unsigned int offset, const void *data, unsigned i
370370
}
371371
}
372372

373-
if (offset != flash_img_bytes_written(ctx) + ctx->stream.buf_bytes) {
374-
rc = MGMT_ERR_EUNKNOWN;
375-
goto out;
376-
}
377-
378373
if (flash_img_buffered_write(ctx, data, num_bytes, last) != 0) {
379374
rc = MGMT_ERR_EUNKNOWN;
380375
goto out;
@@ -402,10 +397,6 @@ img_mgmt_impl_write_image_data(unsigned int offset, const void *data, unsigned i
402397
}
403398
}
404399

405-
if (offset != ctx.stream.bytes_written + ctx.stream.buf_bytes) {
406-
return MGMT_ERR_EUNKNOWN;
407-
}
408-
409400
if (flash_img_buffered_write(&ctx, data, num_bytes, last) != 0) {
410401
return MGMT_ERR_EUNKNOWN;
411402
}

0 commit comments

Comments
 (0)