From 57db336b98d44917bf47419ad4d400c6ee79b30d Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Thu, 4 Jun 2020 09:51:39 +0200 Subject: [PATCH] dfu: flash_img: Constify flash_img_buffered_write() data parameter The data passed has no reason to be changed and can therefore be passed as read only. Signed-off-by: Xavier Chapron --- include/dfu/flash_img.h | 2 +- subsys/dfu/img_util/flash_img.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dfu/flash_img.h b/include/dfu/flash_img.h index accf0e565db..9bdf0ef46f2 100644 --- a/include/dfu/flash_img.h +++ b/include/dfu/flash_img.h @@ -65,7 +65,7 @@ size_t flash_img_bytes_written(struct flash_img_context *ctx); * * @return 0 on success, negative errno code on fail */ -int flash_img_buffered_write(struct flash_img_context *ctx, uint8_t *data, +int flash_img_buffered_write(struct flash_img_context *ctx, const uint8_t *data, size_t len, bool flush); #ifdef __cplusplus diff --git a/subsys/dfu/img_util/flash_img.c b/subsys/dfu/img_util/flash_img.c index f0c5cefaa91..e2191fc18c8 100644 --- a/subsys/dfu/img_util/flash_img.c +++ b/subsys/dfu/img_util/flash_img.c @@ -31,7 +31,7 @@ BUILD_ASSERT((CONFIG_IMG_BLOCK_BUF_SIZE % FLASH_WRITE_BLOCK_SIZE == 0), "CONFIG_IMG_BLOCK_BUF_SIZE is not a multiple of " "FLASH_WRITE_BLOCK_SIZE"); -int flash_img_buffered_write(struct flash_img_context *ctx, uint8_t *data, +int flash_img_buffered_write(struct flash_img_context *ctx, const uint8_t *data, size_t len, bool flush) { int rc;