- new_slot->hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL);
- if (!new_slot->hotplug_slot) {
- kfree (new_slot);
- return -ENOMEM;
- }
- memset(new_slot->hotplug_slot, 0, sizeof (struct hotplug_slot));
-
- new_slot->hotplug_slot->info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
- if (!new_slot->hotplug_slot->info) {
- kfree (new_slot->hotplug_slot);
- kfree (new_slot);
- return -ENOMEM;
- }
- memset(new_slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
- new_slot->hotplug_slot->name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL);
- if (!new_slot->hotplug_slot->name) {
- kfree (new_slot->hotplug_slot->info);
- kfree (new_slot->hotplug_slot);
- kfree (new_slot);
- return -ENOMEM;
- }
+ new_slot->hotplug_slot =
+ kmalloc(sizeof(*(new_slot->hotplug_slot)),
+ GFP_KERNEL);
+ if (!new_slot->hotplug_slot)
+ goto error_slot;
+ memset(new_slot->hotplug_slot, 0, sizeof(struct hotplug_slot));
+
+ new_slot->hotplug_slot->info =
+ kmalloc(sizeof(*(new_slot->hotplug_slot->info)),
+ GFP_KERNEL);
+ if (!new_slot->hotplug_slot->info)
+ goto error_hpslot;
+ memset(new_slot->hotplug_slot->info, 0,
+ sizeof(struct hotplug_slot_info));
+ new_slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE,
+ GFP_KERNEL);
+ if (!new_slot->hotplug_slot->name)
+ goto error_info;