sh: fix no sys_timer case
PATCH 3/5 sh: fix no sys_timer case
From: Magnus Damm <[email protected]>
Handle the case with a sys_timer set to NULL.
Signed-off-by Magnus Damm <[email protected]>
---
arch/sh/kernel/time_32.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/sh/kernel/time_32.c +11 -2
@@ -18,6 +18,7 @@#include <linux/clockchips.h> #include <linux/mc146818rtc.h> /* for rtc_lock */ #include <linux/smp.h> +#include <linux/platform_device.h> #include <asm/clock.h> #include <asm/rtc.h> #include <asm/timer.h>
@@ -181,7 +182,12 @@ static struct sysdev_class timer_sysclasstatic int __init timer_init_sysfs (void ) { -int ret =sysdev_class_register (&timer_sysclass); +int ret; + +if (!sys_timer) +return 0 ; + + ret =sysdev_class_register (&timer_sysclass);if (ret !=0 )return ret;
@@ -230,5 +236,8 @@ void __init time_init(void)* initialized for us. */ sys_timer =get_sys_timer (); -printk (KERN_INFO "Using %s for system timer\n" , sys_timer->name); +if (sys_timer) +pr_info ("Using %s for system timer\n" , sys_timer->name); +else +pr_warning ("System timer missing, boot will fail.\n" ); }