diff options
Diffstat (limited to 'virt/lib/irqbypass.c')
-rw-r--r-- | virt/lib/irqbypass.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/virt/lib/irqbypass.c b/virt/lib/irqbypass.c index 09a03b5a21ff..52abac4bb6a2 100644 --- a/virt/lib/irqbypass.c +++ b/virt/lib/irqbypass.c | |||
@@ -89,6 +89,9 @@ int irq_bypass_register_producer(struct irq_bypass_producer *producer) | |||
89 | struct irq_bypass_producer *tmp; | 89 | struct irq_bypass_producer *tmp; |
90 | struct irq_bypass_consumer *consumer; | 90 | struct irq_bypass_consumer *consumer; |
91 | 91 | ||
92 | if (!producer->token) | ||
93 | return -EINVAL; | ||
94 | |||
92 | might_sleep(); | 95 | might_sleep(); |
93 | 96 | ||
94 | if (!try_module_get(THIS_MODULE)) | 97 | if (!try_module_get(THIS_MODULE)) |
@@ -136,6 +139,9 @@ void irq_bypass_unregister_producer(struct irq_bypass_producer *producer) | |||
136 | struct irq_bypass_producer *tmp; | 139 | struct irq_bypass_producer *tmp; |
137 | struct irq_bypass_consumer *consumer; | 140 | struct irq_bypass_consumer *consumer; |
138 | 141 | ||
142 | if (!producer->token) | ||
143 | return; | ||
144 | |||
139 | might_sleep(); | 145 | might_sleep(); |
140 | 146 | ||
141 | if (!try_module_get(THIS_MODULE)) | 147 | if (!try_module_get(THIS_MODULE)) |
@@ -177,7 +183,8 @@ int irq_bypass_register_consumer(struct irq_bypass_consumer *consumer) | |||
177 | struct irq_bypass_consumer *tmp; | 183 | struct irq_bypass_consumer *tmp; |
178 | struct irq_bypass_producer *producer; | 184 | struct irq_bypass_producer *producer; |
179 | 185 | ||
180 | if (!consumer->add_producer || !consumer->del_producer) | 186 | if (!consumer->token || |
187 | !consumer->add_producer || !consumer->del_producer) | ||
181 | return -EINVAL; | 188 | return -EINVAL; |
182 | 189 | ||
183 | might_sleep(); | 190 | might_sleep(); |
@@ -227,6 +234,9 @@ void irq_bypass_unregister_consumer(struct irq_bypass_consumer *consumer) | |||
227 | struct irq_bypass_consumer *tmp; | 234 | struct irq_bypass_consumer *tmp; |
228 | struct irq_bypass_producer *producer; | 235 | struct irq_bypass_producer *producer; |
229 | 236 | ||
237 | if (!consumer->token) | ||
238 | return; | ||
239 | |||
230 | might_sleep(); | 240 | might_sleep(); |
231 | 241 | ||
232 | if (!try_module_get(THIS_MODULE)) | 242 | if (!try_module_get(THIS_MODULE)) |