diff options
Diffstat (limited to 'drivers/tty/hvc/hvc_udbg.c')
-rw-r--r-- | drivers/tty/hvc/hvc_udbg.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/tty/hvc/hvc_udbg.c b/drivers/tty/hvc/hvc_udbg.c index 4c9b13e7748c..72228276fe31 100644 --- a/drivers/tty/hvc/hvc_udbg.c +++ b/drivers/tty/hvc/hvc_udbg.c | |||
@@ -36,7 +36,7 @@ static int hvc_udbg_put(uint32_t vtermno, const char *buf, int count) | |||
36 | { | 36 | { |
37 | int i; | 37 | int i; |
38 | 38 | ||
39 | for (i = 0; i < count; i++) | 39 | for (i = 0; i < count && udbg_putc; i++) |
40 | udbg_putc(buf[i]); | 40 | udbg_putc(buf[i]); |
41 | 41 | ||
42 | return i; | 42 | return i; |
@@ -67,6 +67,9 @@ static int __init hvc_udbg_init(void) | |||
67 | { | 67 | { |
68 | struct hvc_struct *hp; | 68 | struct hvc_struct *hp; |
69 | 69 | ||
70 | if (!udbg_putc) | ||
71 | return -ENODEV; | ||
72 | |||
70 | BUG_ON(hvc_udbg_dev); | 73 | BUG_ON(hvc_udbg_dev); |
71 | 74 | ||
72 | hp = hvc_alloc(0, 0, &hvc_udbg_ops, 16); | 75 | hp = hvc_alloc(0, 0, &hvc_udbg_ops, 16); |
@@ -88,6 +91,9 @@ module_exit(hvc_udbg_exit); | |||
88 | 91 | ||
89 | static int __init hvc_udbg_console_init(void) | 92 | static int __init hvc_udbg_console_init(void) |
90 | { | 93 | { |
94 | if (!udbg_putc) | ||
95 | return -ENODEV; | ||
96 | |||
91 | hvc_instantiate(0, 0, &hvc_udbg_ops); | 97 | hvc_instantiate(0, 0, &hvc_udbg_ops); |
92 | add_preferred_console("hvc", 0, NULL); | 98 | add_preferred_console("hvc", 0, NULL); |
93 | 99 | ||