]> err.no Git - linux-2.6/commitdiff
drivers/net/wireless/{airo,ipw2100}: fix error handling bugs
authorJeff Garzik <jeff@garzik.org>
Sun, 1 Oct 2006 11:31:09 +0000 (07:31 -0400)
committerJeff Garzik <jeff@garzik.org>
Sun, 1 Oct 2006 11:31:09 +0000 (07:31 -0400)
airo:
* fix oops, if !CONFIG_PROC_FS (create_proc_entry always returns NULL)

* handle pci_register_driver() failure.  if it fails, we really do
  want to exit, rather than (as a comment indicates) return success
  because-we-are-a-library.

* #if 0 have_isa_dev variable, which is assigned a value but never used

ipw2100:
* handle sysfs_create_group() failure

* handle driver_create_file() failure

Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/wireless/airo.c
drivers/net/wireless/ipw2100.c

index ba737c6cebec643a6316a058a0ebc2e0f1ac7d72..39d09345027cbbc0680d95e7c863d09b7ed02b32 100644 (file)
@@ -5659,25 +5659,40 @@ static int airo_pci_resume(struct pci_dev *pdev)
 
 static int __init airo_init_module( void )
 {
-       int i, have_isa_dev = 0;
+       int i;
+#if 0
+       int have_isa_dev = 0;
+#endif
 
        airo_entry = create_proc_entry("aironet",
                                       S_IFDIR | airo_perm,
                                       proc_root_driver);
-        airo_entry->uid = proc_uid;
-        airo_entry->gid = proc_gid;
+
+       if (airo_entry) {
+               airo_entry->uid = proc_uid;
+               airo_entry->gid = proc_gid;
+       }
 
        for( i = 0; i < 4 && io[i] && irq[i]; i++ ) {
                airo_print_info("", "Trying to configure ISA adapter at irq=%d "
                        "io=0x%x", irq[i], io[i] );
                if (init_airo_card( irq[i], io[i], 0, NULL ))
+#if 0
                        have_isa_dev = 1;
+#else
+                       /* do nothing */ ;
+#endif
        }
 
 #ifdef CONFIG_PCI
        airo_print_info("", "Probing for PCI adapters");
-       pci_register_driver(&airo_driver);
+       i = pci_register_driver(&airo_driver);
        airo_print_info("", "Finished probing for PCI adapters");
+
+       if (i) {
+               remove_proc_entry("aironet", proc_root_driver);
+               return i;
+       }
 #endif
 
        /* Always exit with success, as we are a library module
index 6c5add701a6fc9508bdcc34d2b44587c17e882b4..8ec9b73bbdd42e342000b9d2ed8961816803134e 100644 (file)
@@ -6267,7 +6267,9 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
        IPW_DEBUG_INFO("%s: Bound to %s\n", dev->name, pci_name(pci_dev));
 
        /* perform this after register_netdev so that dev->name is set */
-       sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group);
+       err = sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group);
+       if (err)
+               goto fail_unlock;
 
        /* If the RF Kill switch is disabled, go ahead and complete the
         * startup sequence */
@@ -6533,13 +6535,16 @@ static int __init ipw2100_init(void)
        printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT);
 
        ret = pci_register_driver(&ipw2100_pci_driver);
+       if (ret)
+               goto out;
 
 #ifdef CONFIG_IPW2100_DEBUG
        ipw2100_debug_level = debug;
-       driver_create_file(&ipw2100_pci_driver.driver,
-                          &driver_attr_debug_level);
+       ret = driver_create_file(&ipw2100_pci_driver.driver,
+                                &driver_attr_debug_level);
 #endif
 
+out:
        return ret;
 }