
From: Dominik Brodowski <linux@dominikbrodowski.de>

module_refcount() on non-modules fails [in contrary to try_module_get()],
causing this bug when accessing /proc/bus/pccard/drivers and a pcmcia
driver is built into the kernel.

Signed-off-by: Dominik Brodowski <linux@brodo.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/pcmcia/ds.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/pcmcia/ds.c~pcmcia-module_refcount-oops-fix drivers/pcmcia/ds.c
--- 25/drivers/pcmcia/ds.c~pcmcia-module_refcount-oops-fix	Wed Nov  3 16:11:19 2004
+++ 25-akpm/drivers/pcmcia/ds.c	Wed Nov  3 16:11:19 2004
@@ -310,7 +310,7 @@ static int proc_read_drivers_callback(st
 
 	*p += sprintf(*p, "%-24.24s 1 %d\n", p_drv->drv.name,
 #ifdef CONFIG_MODULE_UNLOAD
-		      module_refcount(p_drv->owner)
+		     (p_drv->owner) ? module_refcount(p_drv->owner) : 1
 #else
 		      1
 #endif
_
