aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-01-26 10:02:41 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:35:11 -0800
commit57c95c0d1c9ec83877dfea2f62bebf31059bc93c (patch)
tree864e89551bb003665192973b5d3c6831cc478f95 /drivers/pci
parent287588b3537d0ce56a83f54d0e6ffcd60e54b569 (diff)
[PATCH] shpchp - replace kmalloc() with kzalloc() and cleanup arg of sizeof()
This patch replaces kmalloc() and memset() pair with kzalloc() and cleans up the arg of sizeof() in SHPCHP driver. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/shpchp_core.c15
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c4
2 files changed, 6 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 0dd0642e691..08be8c1f5dc 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -117,22 +117,18 @@ static int init_slots(struct controller *ctrl)
u32 sun;
for (i = 0; i < ctrl->num_slots; i++) {
- slot = kmalloc(sizeof(struct slot), GFP_KERNEL);
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
if (!slot)
goto error;
- memset(slot, 0, sizeof(struct slot));
- hotplug_slot = kmalloc(sizeof(struct hotplug_slot),
- GFP_KERNEL);
+ hotplug_slot = kzalloc(sizeof(*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(*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);
@@ -383,12 +379,11 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!is_shpc_capable(pdev))
return -ENODEV;
- ctrl = kmalloc(sizeof(struct controller), GFP_KERNEL);
+ ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
if (!ctrl) {
err("%s : out of memory\n", __FUNCTION__);
goto err_out_none;
}
- memset(ctrl, 0, sizeof(struct controller));
INIT_LIST_HEAD(&ctrl->slot_list);
rc = shpc_init(ctrl, pdev);
@@ -400,7 +395,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_drvdata(pdev, ctrl);
- ctrl->pci_bus = kmalloc(sizeof (*ctrl->pci_bus), GFP_KERNEL);
+ ctrl->pci_bus = kmalloc(sizeof(*ctrl->pci_bus), GFP_KERNEL);
if (!ctrl->pci_bus) {
err("out of memory\n");
rc = -ENOMEM;
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index c32a1b16704..1a6b5448f81 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -1390,15 +1390,13 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */
spin_lock_init(&list_lock);
- php_ctlr = (struct php_ctlr_state_s *) kmalloc(sizeof(struct php_ctlr_state_s), GFP_KERNEL);
+ php_ctlr = kzalloc(sizeof(*php_ctlr), GFP_KERNEL);
if (!php_ctlr) { /* allocate controller state data */
err("%s: HPC controller memory allocation error!\n", __FUNCTION__);
goto abort;
}
- memset(php_ctlr, 0, sizeof(struct php_ctlr_state_s));
-
php_ctlr->pci_dev = pdev; /* save pci_dev in context */
if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device ==