- new_slot = (struct slot *) kmalloc(sizeof(struct slot), GFP_KERNEL);
- if (!new_slot)
- return -ENOMEM;
-
- memset(new_slot, 0, sizeof(struct slot));
- 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->magic = SLOT_MAGIC;
- new_slot->ctrl = ctrl;
- new_slot->bus = ctrl->bus;
- new_slot->device = slot_device;
- new_slot->number = slot_number;
- dbg("slot->number = %d\n",new_slot->number);
-
- slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, slot_entry);
-
- while (slot_entry && (readw(slot_entry + SMBIOS_SLOT_NUMBER) != new_slot->number)) {
- slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, slot_entry);
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
+ if (!slot)
+ goto error;
+
+ slot->hotplug_slot = kzalloc(sizeof(*(slot->hotplug_slot)),
+ GFP_KERNEL);
+ if (!slot->hotplug_slot)
+ goto error_slot;
+ hotplug_slot = slot->hotplug_slot;
+
+ hotplug_slot->info =
+ kzalloc(sizeof(*(hotplug_slot->info)),
+ GFP_KERNEL);
+ if (!hotplug_slot->info)
+ goto error_hpslot;
+ hotplug_slot_info = hotplug_slot->info;
+ hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
+
+ if (!hotplug_slot->name)
+ goto error_info;
+
+ slot->ctrl = ctrl;
+ slot->bus = ctrl->bus;
+ slot->device = slot_device;
+ slot->number = slot_number;
+ dbg("slot->number = %d\n", slot->number);
+
+ slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9,
+ slot_entry);
+
+ while (slot_entry && (readw(slot_entry + SMBIOS_SLOT_NUMBER) !=
+ slot->number)) {
+ slot_entry = get_SMBIOS_entry(smbios_start,
+ smbios_table, 9, slot_entry);