Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23223
b: refs/heads/master
c: f5afe80
h: refs/heads/master
i:
  23221: 3a5755c
  23219: 6453083
  23215: 3ac8a25
v: v3
  • Loading branch information
Eric Sesterhenn authored and Greg Kroah-Hartman committed Mar 23, 2006
1 parent 79dc925 commit d456fce
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 170 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7c8f25da12a3dda46fb730699582895d5fc51287
refs/heads/master: f5afe8064f3087bead8fea7e32547c2a3ada5fd0
14 changes: 4 additions & 10 deletions trunk/drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
device = (adr >> 16) & 0xffff;
function = adr & 0xffff;

newfunc = kmalloc(sizeof(struct acpiphp_func), GFP_KERNEL);
newfunc = kzalloc(sizeof(struct acpiphp_func), GFP_KERNEL);
if (!newfunc)
return AE_NO_MEMORY;
memset(newfunc, 0, sizeof(struct acpiphp_func));

INIT_LIST_HEAD(&newfunc->sibling);
newfunc->handle = handle;
Expand Down Expand Up @@ -189,13 +188,12 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
}

if (!slot) {
slot = kmalloc(sizeof(struct acpiphp_slot), GFP_KERNEL);
slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL);
if (!slot) {
kfree(newfunc);
return AE_NO_MEMORY;
}

memset(slot, 0, sizeof(struct acpiphp_slot));
slot->bridge = bridge;
slot->device = device;
slot->sun = sun;
Expand Down Expand Up @@ -376,12 +374,10 @@ static void add_host_bridge(acpi_handle *handle, struct pci_bus *pci_bus)
{
struct acpiphp_bridge *bridge;

bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
if (bridge == NULL)
return;

memset(bridge, 0, sizeof(struct acpiphp_bridge));

bridge->type = BRIDGE_TYPE_HOST;
bridge->handle = handle;

Expand All @@ -398,14 +394,12 @@ static void add_p2p_bridge(acpi_handle *handle, struct pci_dev *pci_dev)
{
struct acpiphp_bridge *bridge;

bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
if (bridge == NULL) {
err("out of memory\n");
return;
}

memset(bridge, 0, sizeof(struct acpiphp_bridge));

bridge->type = BRIDGE_TYPE_P2P;
bridge->handle = handle;

Expand Down
9 changes: 3 additions & 6 deletions trunk/drivers/pci/hotplug/cpci_hotplug_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,19 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
* with the pci_hotplug subsystem.
*/
for (i = first; i <= last; ++i) {
slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
slot = kzalloc(sizeof (struct slot), GFP_KERNEL);
if (!slot)
goto error;
memset(slot, 0, sizeof (struct slot));

hotplug_slot =
kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
kzalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
if (!hotplug_slot)
goto error_slot;
memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
slot->hotplug_slot = hotplug_slot;

info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
info = kzalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
if (!info)
goto error_hpslot;
memset(info, 0, sizeof (struct hotplug_slot_info));
hotplug_slot->info = info;

name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
Expand Down
13 changes: 4 additions & 9 deletions trunk/drivers/pci/hotplug/cpqphp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,26 +347,22 @@ static int ctrl_slot_setup(struct controller *ctrl,
slot_number = ctrl->first_slot;

while (number_of_slots) {
slot = kmalloc(sizeof(*slot), GFP_KERNEL);
slot = kzalloc(sizeof(*slot), GFP_KERNEL);
if (!slot)
goto error;

memset(slot, 0, sizeof(struct slot));
slot->hotplug_slot = kmalloc(sizeof(*(slot->hotplug_slot)),
slot->hotplug_slot = kzalloc(sizeof(*(slot->hotplug_slot)),
GFP_KERNEL);
if (!slot->hotplug_slot)
goto error_slot;
hotplug_slot = slot->hotplug_slot;
memset(hotplug_slot, 0, sizeof(struct hotplug_slot));

hotplug_slot->info =
kmalloc(sizeof(*(hotplug_slot->info)),
kzalloc(sizeof(*(hotplug_slot->info)),
GFP_KERNEL);
if (!hotplug_slot->info)
goto error_hpslot;
hotplug_slot_info = hotplug_slot->info;
memset(hotplug_slot_info, 0,
sizeof(struct hotplug_slot_info));
hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);

if (!hotplug_slot->name)
Expand Down Expand Up @@ -854,13 +850,12 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_disable_device;
}

ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);
ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL);
if (!ctrl) {
err("%s : out of memory\n", __FUNCTION__);
rc = -ENOMEM;
goto err_disable_device;
}
memset(ctrl, 0, sizeof(struct controller));

rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid);
if (rc) {
Expand Down
9 changes: 3 additions & 6 deletions trunk/drivers/pci/hotplug/fakephp.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,13 @@ static int add_slot(struct pci_dev *dev)
struct hotplug_slot *slot;
int retval = -ENOMEM;

slot = kmalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
if (!slot)
goto error;
memset(slot, 0, sizeof(*slot));

slot->info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
slot->info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
if (!slot->info)
goto error_slot;
memset(slot->info, 0, sizeof(struct hotplug_slot_info));

slot->info->power_status = 1;
slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
Expand Down Expand Up @@ -227,11 +225,10 @@ static void pci_rescan_bus(const struct pci_bus *bus)
{
unsigned int devfn;
struct pci_dev *dev;
dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
if (!dev)
return;

memset(dev, 0, sizeof(dev));
dev->bus = (struct pci_bus*)bus;
dev->sysdata = bus->sysdata;
for (devfn = 0; devfn < 0x100; devfn += 8) {
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/pci/hotplug/ibmphp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,15 +1141,14 @@ static int enable_slot(struct hotplug_slot *hs)
goto error_power;
}

slot_cur->func = kmalloc(sizeof(struct pci_func), GFP_KERNEL);
slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
/* We cannot do update_slot_info here, since no memory for
* kmalloc n.e.ways, and update_slot_info allocates some */
err("out of system memory\n");
rc = -ENOMEM;
goto error_power;
}
memset(slot_cur->func, 0, sizeof(struct pci_func));
slot_cur->func->busno = slot_cur->bus;
slot_cur->func->device = slot_cur->device;
for (i = 0; i < 4; i++)
Expand Down Expand Up @@ -1252,13 +1251,12 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)

if (slot_cur->func == NULL) {
/* We need this for fncs's that were there on bootup */
slot_cur->func = kmalloc(sizeof(struct pci_func), GFP_KERNEL);
slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
err("out of system memory\n");
rc = -ENOMEM;
goto error;
}
memset(slot_cur->func, 0, sizeof(struct pci_func));
slot_cur->func->busno = slot_cur->bus;
slot_cur->func->device = slot_cur->device;
}
Expand Down
57 changes: 14 additions & 43 deletions trunk/drivers/pci/hotplug/ibmphp_ebda.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,7 @@ static int ebda_rio_table (void);

static struct ebda_hpc_list * __init alloc_ebda_hpc_list (void)
{
struct ebda_hpc_list *list;

list = kmalloc (sizeof (struct ebda_hpc_list), GFP_KERNEL);
if (!list)
return NULL;
memset (list, 0, sizeof (*list));
return list;
return kzalloc(sizeof(struct ebda_hpc_list), GFP_KERNEL);
}

static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count)
Expand All @@ -87,21 +81,18 @@ static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count)
struct ebda_hpc_slot *slots;
struct ebda_hpc_bus *buses;

controller = kmalloc (sizeof (struct controller), GFP_KERNEL);
controller = kzalloc(sizeof(struct controller), GFP_KERNEL);
if (!controller)
goto error;
memset (controller, 0, sizeof (*controller));

slots = kmalloc (sizeof (struct ebda_hpc_slot) * slot_count, GFP_KERNEL);
slots = kcalloc(slot_count, sizeof(struct ebda_hpc_slot), GFP_KERNEL);
if (!slots)
goto error_contr;
memset (slots, 0, sizeof (*slots) * slot_count);
controller->slots = slots;

buses = kmalloc (sizeof (struct ebda_hpc_bus) * bus_count, GFP_KERNEL);
buses = kcalloc(bus_count, sizeof(struct ebda_hpc_bus), GFP_KERNEL);
if (!buses)
goto error_slots;
memset (buses, 0, sizeof (*buses) * bus_count);
controller->buses = buses;

return controller;
Expand All @@ -122,24 +113,12 @@ static void free_ebda_hpc (struct controller *controller)

static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list (void)
{
struct ebda_rsrc_list *list;

list = kmalloc (sizeof (struct ebda_rsrc_list), GFP_KERNEL);
if (!list)
return NULL;
memset (list, 0, sizeof (*list));
return list;
return kzalloc(sizeof(struct ebda_rsrc_list), GFP_KERNEL);
}

static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc (void)
{
struct ebda_pci_rsrc *resource;

resource = kmalloc (sizeof (struct ebda_pci_rsrc), GFP_KERNEL);
if (!resource)
return NULL;
memset (resource, 0, sizeof (*resource));
return resource;
return kzalloc(sizeof(struct ebda_pci_rsrc), GFP_KERNEL);
}

static void __init print_bus_info (void)
Expand Down Expand Up @@ -390,10 +369,9 @@ int __init ibmphp_access_ebda (void)
debug ("now enter io table ---\n");
debug ("rio blk id: %x\n", blk_id);

rio_table_ptr = kmalloc (sizeof (struct rio_table_hdr), GFP_KERNEL);
rio_table_ptr = kzalloc(sizeof(struct rio_table_hdr), GFP_KERNEL);
if (!rio_table_ptr)
return -ENOMEM;
memset (rio_table_ptr, 0, sizeof (struct rio_table_hdr) );
rio_table_ptr->ver_num = readb (io_mem + offset);
rio_table_ptr->scal_count = readb (io_mem + offset + 1);
rio_table_ptr->riodev_count = readb (io_mem + offset + 2);
Expand Down Expand Up @@ -445,10 +423,9 @@ static int __init ebda_rio_table (void)

// we do concern about rio details
for (i = 0; i < rio_table_ptr->riodev_count; i++) {
rio_detail_ptr = kmalloc (sizeof (struct rio_detail), GFP_KERNEL);
rio_detail_ptr = kzalloc(sizeof(struct rio_detail), GFP_KERNEL);
if (!rio_detail_ptr)
return -ENOMEM;
memset (rio_detail_ptr, 0, sizeof (struct rio_detail));
rio_detail_ptr->rio_node_id = readb (io_mem + offset);
rio_detail_ptr->bbar = readl (io_mem + offset + 1);
rio_detail_ptr->rio_type = readb (io_mem + offset + 5);
Expand Down Expand Up @@ -503,10 +480,9 @@ static int __init combine_wpg_for_chassis (void)
rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list);
opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num);
if (!opt_rio_ptr) {
opt_rio_ptr = (struct opt_rio *) kmalloc (sizeof (struct opt_rio), GFP_KERNEL);
opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL);
if (!opt_rio_ptr)
return -ENOMEM;
memset (opt_rio_ptr, 0, sizeof (struct opt_rio));
opt_rio_ptr->rio_type = rio_detail_ptr->rio_type;
opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num;
opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num;
Expand Down Expand Up @@ -546,10 +522,9 @@ static int combine_wpg_for_expansion (void)
rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list);
opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num);
if (!opt_rio_lo_ptr) {
opt_rio_lo_ptr = (struct opt_rio_lo *) kmalloc (sizeof (struct opt_rio_lo), GFP_KERNEL);
opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL);
if (!opt_rio_lo_ptr)
return -ENOMEM;
memset (opt_rio_lo_ptr, 0, sizeof (struct opt_rio_lo));
opt_rio_lo_ptr->rio_type = rio_detail_ptr->rio_type;
opt_rio_lo_ptr->chassis_num = rio_detail_ptr->chassis_num;
opt_rio_lo_ptr->first_slot_num = rio_detail_ptr->first_slot_num;
Expand Down Expand Up @@ -842,12 +817,11 @@ static int __init ebda_rsrc_controller (void)

bus_info_ptr2 = ibmphp_find_same_bus_num (slot_ptr->slot_bus_num);
if (!bus_info_ptr2) {
bus_info_ptr1 = (struct bus_info *) kmalloc (sizeof (struct bus_info), GFP_KERNEL);
bus_info_ptr1 = kzalloc(sizeof(struct bus_info), GFP_KERNEL);
if (!bus_info_ptr1) {
rc = -ENOMEM;
goto error_no_hp_slot;
}
memset (bus_info_ptr1, 0, sizeof (struct bus_info));
bus_info_ptr1->slot_min = slot_ptr->slot_num;
bus_info_ptr1->slot_max = slot_ptr->slot_num;
bus_info_ptr1->slot_count += 1;
Expand Down Expand Up @@ -946,32 +920,29 @@ static int __init ebda_rsrc_controller (void)
// register slots with hpc core as well as create linked list of ibm slot
for (index = 0; index < hpc_ptr->slot_count; index++) {

hp_slot_ptr = kmalloc(sizeof(*hp_slot_ptr), GFP_KERNEL);
hp_slot_ptr = kzalloc(sizeof(*hp_slot_ptr), GFP_KERNEL);
if (!hp_slot_ptr) {
rc = -ENOMEM;
goto error_no_hp_slot;
}
memset(hp_slot_ptr, 0, sizeof(*hp_slot_ptr));

hp_slot_ptr->info = kmalloc (sizeof(struct hotplug_slot_info), GFP_KERNEL);
hp_slot_ptr->info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
if (!hp_slot_ptr->info) {
rc = -ENOMEM;
goto error_no_hp_info;
}
memset(hp_slot_ptr->info, 0, sizeof(struct hotplug_slot_info));

hp_slot_ptr->name = kmalloc(30, GFP_KERNEL);
if (!hp_slot_ptr->name) {
rc = -ENOMEM;
goto error_no_hp_name;
}

tmp_slot = kmalloc(sizeof(*tmp_slot), GFP_KERNEL);
tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL);
if (!tmp_slot) {
rc = -ENOMEM;
goto error_no_slot;
}
memset(tmp_slot, 0, sizeof(*tmp_slot));

tmp_slot->flag = TRUE;

Expand Down
Loading

0 comments on commit d456fce

Please sign in to comment.