This is an automated email from Gerrit.

"Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/7097

-- gerrit

commit 51a0eac14ae21a10b013c1586362a0dff005cf86
Author: Tomas Vanek <van...@fbl.cz>
Date:   Sun Jul 31 07:44:24 2022 +0200

    flash/nor/stm32l4x: use ALIGN_xx macros
    
    Use ALIGN_xx macros for computation of the size of the buffer
    for async block write algo.
    
    Just cosmetic, no functional change.
    
    Change-Id: I9aa61b428b9fcc3ed9b18dbe2746842713645ac9
    Signed-off-by: Tomas Vanek <van...@fbl.cz>

diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c
index 2b428f032a..c54c8136b1 100644
--- a/src/flash/nor/stm32l4x.c
+++ b/src/flash/nor/stm32l4x.c
@@ -1366,11 +1366,11 @@ static int stm32l4_write_block(struct flash_bank *bank, 
const uint8_t *buffer,
        }
 
        /* data_width should be multiple of double-word */
-       assert(stm32l4_info->data_width % 8 == 0);
+       assert(IS_ALIGNED(stm32l4_info->data_width, 8));
        const size_t extra_size = sizeof(struct stm32l4_work_area);
        uint32_t buffer_size = target_get_working_area_avail(target) - 
extra_size;
        /* buffer_size should be multiple of stm32l4_info->data_width */
-       buffer_size &= ~(stm32l4_info->data_width - 1);
+       buffer_size = ALIGN_DOWN(buffer_size, stm32l4_info->data_width);
 
        if (buffer_size < 256) {
                LOG_WARNING("large enough working area not available, can't do 
block memory writes");

-- 

Reply via email to