diff options
author | Zhao, Yu <yu.zhao@intel.com> | 2008-09-22 02:26:05 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-10-20 13:54:25 -0400 |
commit | c8761fe80ed052634153438405c9048611ae7ae1 (patch) | |
tree | 4a8a58efa1260310c96c7f1d9e08f11cd042e71c | |
parent | 11d587429e9cbb40ac20d7ed8126c66da0d7aba5 (diff) |
PCI: fix hotplug get_##name return value problem
Currently, get_##name in pci_hotplug_core.c will return 0 if module
unload wins the race between unload & reading the hotplug file. Fix
that case to return -ENODEV like it should.
Reviewed-by: Alex Chiang <achiang@hp.com>
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 5f85b1b120e3..27d2b6fe5d53 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -102,13 +102,13 @@ static int get_##name (struct hotplug_slot *slot, type *value) \ | |||
102 | { \ | 102 | { \ |
103 | struct hotplug_slot_ops *ops = slot->ops; \ | 103 | struct hotplug_slot_ops *ops = slot->ops; \ |
104 | int retval = 0; \ | 104 | int retval = 0; \ |
105 | if (try_module_get(ops->owner)) { \ | 105 | if (try_module_get(ops->owner)) \ |
106 | if (ops->get_##name) \ | 106 | return -ENODEV; \ |
107 | retval = ops->get_##name(slot, value); \ | 107 | if (ops->get_##name) \ |
108 | else \ | 108 | retval = ops->get_##name(slot, value); \ |
109 | *value = slot->info->name; \ | 109 | else \ |
110 | module_put(ops->owner); \ | 110 | *value = slot->info->name; \ |
111 | } \ | 111 | module_put(ops->owner); \ |
112 | return retval; \ | 112 | return retval; \ |
113 | } | 113 | } |
114 | 114 | ||