diff options
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 1e6d354fff38..dc12b0dbb9b2 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -53,6 +53,7 @@ extern int shpchp_debug; | |||
53 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | 53 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) |
54 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 54 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) |
55 | 55 | ||
56 | #define SLOT_NAME_SIZE 10 | ||
56 | struct slot { | 57 | struct slot { |
57 | u8 bus; | 58 | u8 bus; |
58 | u8 device; | 59 | u8 device; |
@@ -68,6 +69,7 @@ struct slot { | |||
68 | struct hpc_ops *hpc_ops; | 69 | struct hpc_ops *hpc_ops; |
69 | struct hotplug_slot *hotplug_slot; | 70 | struct hotplug_slot *hotplug_slot; |
70 | struct list_head slot_list; | 71 | struct list_head slot_list; |
72 | char name[SLOT_NAME_SIZE]; | ||
71 | }; | 73 | }; |
72 | 74 | ||
73 | struct event_info { | 75 | struct event_info { |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 4161da4bf4ba..cb4ac43ea95c 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -94,12 +94,10 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
94 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 94 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); |
95 | 95 | ||
96 | kfree(slot->hotplug_slot->info); | 96 | kfree(slot->hotplug_slot->info); |
97 | kfree(slot->hotplug_slot->name); | ||
98 | kfree(slot->hotplug_slot); | 97 | kfree(slot->hotplug_slot); |
99 | kfree(slot); | 98 | kfree(slot); |
100 | } | 99 | } |
101 | 100 | ||
102 | #define SLOT_NAME_SIZE 10 | ||
103 | static void make_slot_name(struct slot *slot) | 101 | static void make_slot_name(struct slot *slot) |
104 | { | 102 | { |
105 | snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", | 103 | snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", |
@@ -111,7 +109,6 @@ static int init_slots(struct controller *ctrl) | |||
111 | struct slot *slot; | 109 | struct slot *slot; |
112 | struct hotplug_slot *hotplug_slot; | 110 | struct hotplug_slot *hotplug_slot; |
113 | struct hotplug_slot_info *info; | 111 | struct hotplug_slot_info *info; |
114 | char *name; | ||
115 | int retval = -ENOMEM; | 112 | int retval = -ENOMEM; |
116 | int i; | 113 | int i; |
117 | u32 sun; | 114 | u32 sun; |
@@ -131,10 +128,7 @@ static int init_slots(struct controller *ctrl) | |||
131 | goto error_hpslot; | 128 | goto error_hpslot; |
132 | hotplug_slot->info = info; | 129 | hotplug_slot->info = info; |
133 | 130 | ||
134 | name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); | 131 | hotplug_slot->name = slot->name; |
135 | if (!name) | ||
136 | goto error_info; | ||
137 | hotplug_slot->name = name; | ||
138 | 132 | ||
139 | slot->hp_slot = i; | 133 | slot->hp_slot = i; |
140 | slot->ctrl = ctrl; | 134 | slot->ctrl = ctrl; |
@@ -144,7 +138,7 @@ static int init_slots(struct controller *ctrl) | |||
144 | 138 | ||
145 | if (shpchprm_get_physical_slot_number(ctrl, &sun, | 139 | if (shpchprm_get_physical_slot_number(ctrl, &sun, |
146 | slot->bus, slot->device)) | 140 | slot->bus, slot->device)) |
147 | goto error_name; | 141 | goto error_info; |
148 | 142 | ||
149 | slot->number = sun; | 143 | slot->number = sun; |
150 | 144 | ||
@@ -165,15 +159,13 @@ static int init_slots(struct controller *ctrl) | |||
165 | retval = pci_hp_register(slot->hotplug_slot); | 159 | retval = pci_hp_register(slot->hotplug_slot); |
166 | if (retval) { | 160 | if (retval) { |
167 | err("pci_hp_register failed with error %d\n", retval); | 161 | err("pci_hp_register failed with error %d\n", retval); |
168 | goto error_name; | 162 | goto error_info; |
169 | } | 163 | } |
170 | 164 | ||
171 | list_add(&slot->slot_list, &ctrl->slot_list); | 165 | list_add(&slot->slot_list, &ctrl->slot_list); |
172 | } | 166 | } |
173 | 167 | ||
174 | return 0; | 168 | return 0; |
175 | error_name: | ||
176 | kfree(name); | ||
177 | error_info: | 169 | error_info: |
178 | kfree(info); | 170 | kfree(info); |
179 | error_hpslot: | 171 | error_hpslot: |