From 486fb6504c627d6c8ff58ad510e1859479e0d721 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 9 Aug 2022 21:55:38 +0100 Subject: [PATCH] stm32g0: Cleaned up stm32g0_flash_lock --- src/target/stm32g0.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/target/stm32g0.c b/src/target/stm32g0.c index eeff379..758e95e 100644 --- a/src/target/stm32g0.c +++ b/src/target/stm32g0.c @@ -315,9 +315,8 @@ static void stm32g0_flash_unlock(target *t) static void stm32g0_flash_lock(target *t) { - uint32_t flash_cr = target_mem_read32(t, FLASH_CR); - flash_cr |= (uint32_t)FLASH_CR_LOCK; - target_mem_write32(t, FLASH_CR, flash_cr); + const uint32_t ctrl = target_mem_read32(t, FLASH_CR) | FLASH_CR_LOCK; + target_mem_write32(t, FLASH_CR, ctrl); } static bool stm32g0_wait_busy(target *const t)