Commit c8761fe8 authored by Zhao, Yu's avatar Zhao, Yu Committed by Jesse Barnes

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: default avatarAlex Chiang <achiang@hp.com>
Reviewed-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: default avatarYu Zhao <yu.zhao@intel.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 11d58742
...@@ -102,13 +102,13 @@ static int get_##name (struct hotplug_slot *slot, type *value) \ ...@@ -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)) \
return -ENODEV; \
if (ops->get_##name) \ if (ops->get_##name) \
retval = ops->get_##name(slot, value); \ retval = ops->get_##name(slot, value); \
else \ else \
*value = slot->info->name; \ *value = slot->info->name; \
module_put(ops->owner); \ module_put(ops->owner); \
} \
return retval; \ return retval; \
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment