Index: driver/modules/hostap_pci.c
===================================================================
RCS file: /home/jm/cvsroot/hostap/driver/modules/hostap_pci.c,v
retrieving revision 1.5
diff -u -u -p -r1.5 hostap_pci.c
--- driver/modules/hostap_pci.c	21 Apr 2002 11:47:58 -0000	1.5
+++ driver/modules/hostap_pci.c	22 Apr 2002 14:58:04 -0000
@@ -248,8 +248,8 @@ static int __init init_prism2_pci(void)
 
 static void __exit exit_prism2_pci(void)
 {
-	prism2_cleanup_proc();
 	pci_unregister_driver(&prism2_pci_drv_id);
+	prism2_cleanup_proc();
 	printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
 }
 
Index: driver/modules/hostap_plx.c
===================================================================
RCS file: /home/jm/cvsroot/hostap/driver/modules/hostap_plx.c,v
retrieving revision 1.7
diff -u -u -p -r1.7 hostap_plx.c
--- driver/modules/hostap_plx.c	21 Apr 2002 11:23:31 -0000	1.7
+++ driver/modules/hostap_plx.c	22 Apr 2002 14:58:04 -0000
@@ -379,8 +379,8 @@ static int __init init_prism2_plx(void)
 
 static void __exit exit_prism2_plx(void)
 {
-	prism2_cleanup_proc();
 	pci_unregister_driver(&prism2_plx_drv_id);
+	prism2_cleanup_proc();
 	printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
 }
 
Index: driver/modules/prism2_proc.c
===================================================================
RCS file: /home/jm/cvsroot/hostap/driver/modules/prism2_proc.c,v
retrieving revision 1.4
diff -u -u -p -r1.4 prism2_proc.c
--- driver/modules/prism2_proc.c	19 Apr 2002 16:41:08 -0000	1.4
+++ driver/modules/prism2_proc.c	22 Apr 2002 14:58:04 -0000
@@ -564,7 +564,8 @@ void prism2_remove_proc(local_info_t *lo
 		remove_proc_entry("registers", local->proc);
 		remove_proc_entry("stats", local->proc);
 		remove_proc_entry("debug", local->proc);
-		if (local->dev != NULL && local->dev->name != NULL)
+		if (local->dev != NULL && local->dev->name != NULL &&
+		    prism2_proc != NULL)
 			remove_proc_entry(local->dev->name, prism2_proc);
 	}
 }
@@ -572,6 +573,8 @@ void prism2_remove_proc(local_info_t *lo
 
 void prism2_cleanup_proc(void)
 {
-	if (prism2_proc != NULL)
+	if (prism2_proc != NULL) {
 		remove_proc_entry("prism2", proc_net);
+		prism2_proc = NULL;
+	}
 }

