From e55f1987a0b7ad762502f854847ca5a754dd7129 Mon Sep 17 00:00:00 2001 From: Steven Slupsky Date: Thu, 20 Feb 2020 08:06:19 -0700 Subject: [PATCH] drivers: flash: sam0: fix unaligned memory read Use the UNALIGNED_GET() macro instead of the flash_sam0_read_unaigned_u32() function to ensure word alignment of the source address. Signed-off-by: Steven Slupsky drivers: flash: sam0: fix whitespace Fix checkpass whitespace error. Signed-off-by: Steven Slupsky --- drivers/flash/flash_sam0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/flash/flash_sam0.c b/drivers/flash/flash_sam0.c index 475b99edd0f..1fd2f9fdca1 100644 --- a/drivers/flash/flash_sam0.c +++ b/drivers/flash/flash_sam0.c @@ -147,7 +147,7 @@ static int flash_sam0_write_page(struct device *dev, off_t offset, /* Ensure writes happen 32 bits at a time. */ for (; src != end; src++, dst++) { - *dst = *src; + *dst = UNALIGNED_GET((u32_t *)src); } #ifdef NVMCTRL_CTRLA_CMD_WP