diff options
author | Christian Krafft <krafft@de.ibm.com> | 2007-04-23 15:35:43 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@klappe.arndb.de> | 2007-04-23 15:44:40 -0400 |
commit | 79baf4a60e8aceb2b8a5bed8575885499cb21ce4 (patch) | |
tree | be23358bee3fc9094485b574cea06201f470ad0b /arch/powerpc/sysdev/pmi.c | |
parent | 5050063c0464663a0b0c3dc9fc5bc822aa74a1dd (diff) |
[POWERPC] add check for initialized driver data to pmi driver
This patch adds a check for the private driver data to be initialized.
The bug showed up, as the caller found a pmi device by it's type.
Whereas the pmi driver probes for the type and the name.
Since the name was not as the driver expected, it did not initialize.
A more relaxed probing will be supplied with an extra patch, too.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/sysdev/pmi.c')
-rw-r--r-- | arch/powerpc/sysdev/pmi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c index a5282011d39e..0b53fed8a9b1 100644 --- a/arch/powerpc/sysdev/pmi.c +++ b/arch/powerpc/sysdev/pmi.c | |||
@@ -279,6 +279,9 @@ void pmi_register_handler(struct of_device *device, | |||
279 | struct pmi_data *data; | 279 | struct pmi_data *data; |
280 | data = device->dev.driver_data; | 280 | data = device->dev.driver_data; |
281 | 281 | ||
282 | if (!data) | ||
283 | return; | ||
284 | |||
282 | spin_lock(&data->handler_spinlock); | 285 | spin_lock(&data->handler_spinlock); |
283 | list_add_tail(&handler->node, &data->handler); | 286 | list_add_tail(&handler->node, &data->handler); |
284 | spin_unlock(&data->handler_spinlock); | 287 | spin_unlock(&data->handler_spinlock); |
@@ -289,10 +292,12 @@ void pmi_unregister_handler(struct of_device *device, | |||
289 | struct pmi_handler *handler) | 292 | struct pmi_handler *handler) |
290 | { | 293 | { |
291 | struct pmi_data *data; | 294 | struct pmi_data *data; |
295 | data = device->dev.driver_data; | ||
292 | 296 | ||
293 | pr_debug("pmi: unregistering handler %p\n", handler); | 297 | if (!data) |
298 | return; | ||
294 | 299 | ||
295 | data = device->dev.driver_data; | 300 | pr_debug("pmi: unregistering handler %p\n", handler); |
296 | 301 | ||
297 | spin_lock(&data->handler_spinlock); | 302 | spin_lock(&data->handler_spinlock); |
298 | list_del(&handler->node); | 303 | list_del(&handler->node); |