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>
This commit is contained in:
parent
11d587429e
commit
c8761fe80e
|
@ -102,13 +102,13 @@ static int get_##name (struct hotplug_slot *slot, type *value) \
|
||||||
{ \
|
{ \
|
||||||
struct hotplug_slot_ops *ops = slot->ops; \
|
struct hotplug_slot_ops *ops = slot->ops; \
|
||||||
int retval = 0; \
|
int retval = 0; \
|
||||||
if (try_module_get(ops->owner)) { \
|
if (try_module_get(ops->owner)) \
|
||||||
if (ops->get_##name) \
|
return -ENODEV; \
|
||||||
retval = ops->get_##name(slot, value); \
|
if (ops->get_##name) \
|
||||||
else \
|
retval = ops->get_##name(slot, value); \
|
||||||
*value = slot->info->name; \
|
else \
|
||||||
module_put(ops->owner); \
|
*value = slot->info->name; \
|
||||||
} \
|
module_put(ops->owner); \
|
||||||
return retval; \
|
return retval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue