]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/pci_hotplug_core.c
PCI: fix hotplug get_##name return value problem
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / pci_hotplug_core.c
index b514162125fbab2b7687c3bb4da0a588af11b60d..27d2b6fe5d532e156697290e3c4eaa380787b030 100644 (file)
@@ -102,13 +102,13 @@ static int get_##name (struct hotplug_slot *slot, type *value)            \
 {                                                                      \
        struct hotplug_slot_ops *ops = slot->ops;                       \
        int retval = 0;                                                 \
-       if (try_module_get(ops->owner)) {                               \
-               if (ops->get_##name)                                    \
-                       retval = ops->get_##name(slot, value);          \
-               else                                                    \
-                       *value = slot->info->name;                      \
-               module_put(ops->owner);                                 \
-       }                                                               \
+       if (try_module_get(ops->owner))                                 \
+               return -ENODEV;                                         \
+       if (ops->get_##name)                                            \
+               retval = ops->get_##name(slot, value);                  \
+       else                                                            \
+               *value = slot->info->name;                              \
+       module_put(ops->owner);                                         \
        return retval;                                                  \
 }
 
@@ -557,7 +557,6 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
 {
        int result;
        struct pci_slot *pci_slot;
-       struct hotplug_slot *tmp;
 
        if (slot == NULL)
                return -ENODEV;
@@ -570,8 +569,7 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
        }
 
        /* Check if we have already registered a slot with the same name. */
-       tmp = get_slot_from_name(slot->name);
-       if (tmp)
+       if (get_slot_from_name(slot->name))
                return -EEXIST;
 
        /*