linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] powerpc: add check for initialized driver data to pmi driver
@ 2007-04-23 18:22 Christian Krafft
  2007-04-24  5:53 ` Heiko J Schick
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Krafft @ 2007-04-23 18:22 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: krafft, cbe-oss-dev

[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

From: Christian Krafft <krafft@de.ibm.com>
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>

Index: sdk3/arch/powerpc/sysdev/pmi.c
===================================================================
--- sdk3.orig/arch/powerpc/sysdev/pmi.c
+++ sdk3/arch/powerpc/sysdev/pmi.c
@@ -264,6 +264,9 @@ void pmi_register_handler(struct of_devi
 	struct pmi_data *data;
 	data = device->dev.driver_data;
 
+	if (!data)
+		return;
+
 	spin_lock(&data->handler_spinlock);
 	list_add_tail(&handler->node, &data->handler);
 	spin_unlock(&data->handler_spinlock);
@@ -274,10 +277,12 @@ void pmi_unregister_handler(struct of_de
 			    struct pmi_handler *handler)
 {
 	struct pmi_data *data;
+	data = device->dev.driver_data;
 
-	pr_debug("pmi: unregistering handler %p\n", handler);
+	if (!data)
+		return;
 
-	data = device->dev.driver_data;
+	pr_debug("pmi: unregistering handler %p\n", handler);
 
 	spin_lock(&data->handler_spinlock);
 	list_del(&handler->node);


-- 
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems & Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats:	Johann Weihen
Geschaeftsfuehrung:		Herbert Kircher
Sitz der Gesellschaft:		Boeblingen
Registriergericht:		Amtsgericht Stuttgart, HRB 243294


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-24  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-23 18:22 [patch 1/2] powerpc: add check for initialized driver data to pmi driver Christian Krafft
2007-04-24  5:53 ` Heiko J Schick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).