Skip to content

Commit 25673c3

Browse files
committed
bcm2708: Avoid hang when timer_set_next_event is called with MAX_INT
See: raspberrypi#616
1 parent 39e4e12 commit 25673c3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎arch/arm/mach-bcm2708/bcm2708.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,8 @@ static int timer_set_next_event(unsigned long cycles,
885885
stc = readl(__io_address(ST_BASE + 0x04));
886886
/* We could take a FIQ here, which may push ST above STC3 */
887887
writel(stc + cycles, __io_address(ST_BASE + 0x18));
888-
} while ((signed long) (readl(__io_address(ST_BASE + 0x04)) - stc)
888+
} while ((signed long) cycles >= 0 &&
889+
(signed long) (readl(__io_address(ST_BASE + 0x04)) - stc)
889890
>= (signed long) cycles);
890891
return 0;
891892
}

0 commit comments

Comments
 (0)