]> git.hungrycats.org Git - linux/commitdiff
[ARM PATCH] 2132/1: Fix timer NULL pointer de-reference on suspend
authorBen Dooks <ben-linux@org.rmk.(none)>
Tue, 19 Oct 2004 18:49:21 +0000 (19:49 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Tue, 19 Oct 2004 18:49:21 +0000 (19:49 +0100)
Patch from Ben Dooks

Timer suspend code fails to check for NULL before
calling the timer implementor's suspend or resume hooks.

Signed-off-by: Ben Dooks
arch/arm/kernel/time.c

index f80a89de33c3b6d8ce8007dd41a5d41690021a2a..725a74d8580dc8f7aef282865596d9b60f407f33 100644 (file)
@@ -351,14 +351,20 @@ void timer_tick(struct pt_regs *regs)
 static int timer_suspend(struct sys_device *dev, u32 state)
 {
        struct sys_timer *timer = container_of(dev, struct sys_timer, dev);
-       timer->suspend();
+
+       if (timer->suspend != NULL)
+               timer->suspend();
+
        return 0;
 }
 
 static int timer_resume(struct sys_device *dev)
 {
        struct sys_timer *timer = container_of(dev, struct sys_timer, dev);
-       timer->resume();
+
+       if (timer->resume != NULL)
+               timer->resume();
+
        return 0;
 }
 #else