diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c index bc4b865403..99c83422f7 100644 --- a/chip/lm4/clock.c +++ b/chip/lm4/clock.c @@ -140,8 +140,8 @@ void clock_enable_pll(int enable, int notify) void clock_wait_cycles(uint32_t cycles) { - asm("1: subs %0, #1\n" - " bne 1b\n" :: "r"(cycles)); + asm volatile("1: subs %0, #1\n" + " bne 1b\n" : "+r"(cycles)); } int clock_get_freq(void) diff --git a/chip/mec1322/clock.c b/chip/mec1322/clock.c index c305b16ffc..d86f1bc5a7 100644 --- a/chip/mec1322/clock.c +++ b/chip/mec1322/clock.c @@ -49,8 +49,8 @@ static int freq = 48000000; void clock_wait_cycles(uint32_t cycles) { - asm("1: subs %0, #1\n" - " bne 1b\n" :: "r"(cycles)); + asm volatile("1: subs %0, #1\n" + " bne 1b\n" : "+r"(cycles)); } int clock_get_freq(void) diff --git a/chip/npcx/clock.c b/chip/npcx/clock.c index 196248c592..34a9b6a726 100644 --- a/chip/npcx/clock.c +++ b/chip/npcx/clock.c @@ -227,8 +227,8 @@ int clock_get_apb2_freq(void) */ void clock_wait_cycles(uint32_t cycles) { - asm("1: subs %0, #1\n" - " bne 1b\n" : : "r"(cycles)); + asm volatile("1: subs %0, #1\n" + " bne 1b\n" : "+r"(cycles)); } #ifdef CONFIG_LOW_POWER_IDLE