Skip to content

Commit bd4fb4d

Browse files
Stuart Menefypmundt
authored andcommitted
sh: Fix underflow in SH udelay() code.
Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent 6d243dd commit bd4fb4d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎arch/sh/lib/delay.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ void __delay(unsigned long loops)
2121

2222
inline void __const_udelay(unsigned long xloops)
2323
{
24+
xloops *= 4;
2425
__asm__("dmulu.l %0, %2\n\t"
2526
"sts mach, %0"
2627
: "=r" (xloops)
2728
: "0" (xloops),
28-
"r" (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy)
29+
"r" (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4))
2930
: "macl", "mach");
30-
__delay(xloops);
31+
__delay(++xloops);
3132
}
3233

3334
void __udelay(unsigned long usecs)

0 commit comments

Comments
 (0)