diff options
Diffstat (limited to 'drivers/pci/hotplug/shpchp_core.c')
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 7414fd9ad1d2..b6de307248e4 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -99,22 +99,28 @@ static int init_slots(struct controller *ctrl) | |||
99 | struct hotplug_slot *hotplug_slot; | 99 | struct hotplug_slot *hotplug_slot; |
100 | struct hotplug_slot_info *info; | 100 | struct hotplug_slot_info *info; |
101 | char name[SLOT_NAME_SIZE]; | 101 | char name[SLOT_NAME_SIZE]; |
102 | int retval = -ENOMEM; | 102 | int retval; |
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | for (i = 0; i < ctrl->num_slots; i++) { | 105 | for (i = 0; i < ctrl->num_slots; i++) { |
106 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | 106 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
107 | if (!slot) | 107 | if (!slot) { |
108 | retval = -ENOMEM; | ||
108 | goto error; | 109 | goto error; |
110 | } | ||
109 | 111 | ||
110 | hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL); | 112 | hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL); |
111 | if (!hotplug_slot) | 113 | if (!hotplug_slot) { |
114 | retval = -ENOMEM; | ||
112 | goto error_slot; | 115 | goto error_slot; |
116 | } | ||
113 | slot->hotplug_slot = hotplug_slot; | 117 | slot->hotplug_slot = hotplug_slot; |
114 | 118 | ||
115 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 119 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
116 | if (!info) | 120 | if (!info) { |
121 | retval = -ENOMEM; | ||
117 | goto error_hpslot; | 122 | goto error_hpslot; |
123 | } | ||
118 | hotplug_slot->info = info; | 124 | hotplug_slot->info = info; |
119 | 125 | ||
120 | slot->hp_slot = i; | 126 | slot->hp_slot = i; |