diff options
Diffstat (limited to 'drivers/message/fusion/mptsas.c')
-rw-r--r-- | drivers/message/fusion/mptsas.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 19fc03ecdf60..668a101b89f0 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -258,13 +258,12 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
258 | struct scsi_target *starget; | 258 | struct scsi_target *starget; |
259 | int i; | 259 | int i; |
260 | 260 | ||
261 | vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL); | 261 | vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
262 | if (!vdev) { | 262 | if (!vdev) { |
263 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", | 263 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", |
264 | hd->ioc->name, sizeof(VirtDevice)); | 264 | hd->ioc->name, sizeof(VirtDevice)); |
265 | return -ENOMEM; | 265 | return -ENOMEM; |
266 | } | 266 | } |
267 | memset(vdev, 0, sizeof(VirtDevice)); | ||
268 | vdev->ioc_id = hd->ioc->id; | 267 | vdev->ioc_id = hd->ioc->id; |
269 | sdev->hostdata = vdev; | 268 | sdev->hostdata = vdev; |
270 | starget = scsi_target(sdev); | 269 | starget = scsi_target(sdev); |
@@ -1044,10 +1043,9 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc, int *index) | |||
1044 | u32 handle = 0xFFFF; | 1043 | u32 handle = 0xFFFF; |
1045 | int error = -ENOMEM, i; | 1044 | int error = -ENOMEM, i; |
1046 | 1045 | ||
1047 | port_info = kmalloc(sizeof(*port_info), GFP_KERNEL); | 1046 | port_info = kzalloc(sizeof(*port_info), GFP_KERNEL); |
1048 | if (!port_info) | 1047 | if (!port_info) |
1049 | goto out; | 1048 | goto out; |
1050 | memset(port_info, 0, sizeof(*port_info)); | ||
1051 | 1049 | ||
1052 | error = mptsas_sas_io_unit_pg0(ioc, port_info); | 1050 | error = mptsas_sas_io_unit_pg0(ioc, port_info); |
1053 | if (error) | 1051 | if (error) |
@@ -1096,10 +1094,9 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle, int *index) | |||
1096 | struct mptsas_portinfo *port_info, *p; | 1094 | struct mptsas_portinfo *port_info, *p; |
1097 | int error = -ENOMEM, i, j; | 1095 | int error = -ENOMEM, i, j; |
1098 | 1096 | ||
1099 | port_info = kmalloc(sizeof(*port_info), GFP_KERNEL); | 1097 | port_info = kzalloc(sizeof(*port_info), GFP_KERNEL); |
1100 | if (!port_info) | 1098 | if (!port_info) |
1101 | goto out; | 1099 | goto out; |
1102 | memset(port_info, 0, sizeof(*port_info)); | ||
1103 | 1100 | ||
1104 | error = mptsas_sas_expander_pg0(ioc, port_info, | 1101 | error = mptsas_sas_expander_pg0(ioc, port_info, |
1105 | (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE << | 1102 | (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE << |
@@ -1390,11 +1387,10 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1390 | MPT_SCSI_HOST *hd; | 1387 | MPT_SCSI_HOST *hd; |
1391 | MPT_ADAPTER *ioc; | 1388 | MPT_ADAPTER *ioc; |
1392 | unsigned long flags; | 1389 | unsigned long flags; |
1393 | int sz, ii; | 1390 | int ii; |
1394 | int numSGE = 0; | 1391 | int numSGE = 0; |
1395 | int scale; | 1392 | int scale; |
1396 | int ioc_cap; | 1393 | int ioc_cap; |
1397 | u8 *mem; | ||
1398 | int error=0; | 1394 | int error=0; |
1399 | int r; | 1395 | int r; |
1400 | 1396 | ||
@@ -1518,36 +1514,27 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1518 | /* SCSI needs scsi_cmnd lookup table! | 1514 | /* SCSI needs scsi_cmnd lookup table! |
1519 | * (with size equal to req_depth*PtrSz!) | 1515 | * (with size equal to req_depth*PtrSz!) |
1520 | */ | 1516 | */ |
1521 | sz = ioc->req_depth * sizeof(void *); | 1517 | hd->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC); |
1522 | mem = kmalloc(sz, GFP_ATOMIC); | 1518 | if (!hd->ScsiLookup) { |
1523 | if (mem == NULL) { | ||
1524 | error = -ENOMEM; | 1519 | error = -ENOMEM; |
1525 | goto out_mptsas_probe; | 1520 | goto out_mptsas_probe; |
1526 | } | 1521 | } |
1527 | 1522 | ||
1528 | memset(mem, 0, sz); | 1523 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", |
1529 | hd->ScsiLookup = (struct scsi_cmnd **) mem; | 1524 | ioc->name, hd->ScsiLookup)); |
1530 | |||
1531 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p, sz=%d\n", | ||
1532 | ioc->name, hd->ScsiLookup, sz)); | ||
1533 | 1525 | ||
1534 | /* Allocate memory for the device structures. | 1526 | /* Allocate memory for the device structures. |
1535 | * A non-Null pointer at an offset | 1527 | * A non-Null pointer at an offset |
1536 | * indicates a device exists. | 1528 | * indicates a device exists. |
1537 | * max_id = 1 + maximum id (hosts.h) | 1529 | * max_id = 1 + maximum id (hosts.h) |
1538 | */ | 1530 | */ |
1539 | sz = sh->max_id * sizeof(void *); | 1531 | hd->Targets = kcalloc(sh->max_id, sizeof(void *), GFP_ATOMIC); |
1540 | mem = kmalloc(sz, GFP_ATOMIC); | 1532 | if (!hd->Targets) { |
1541 | if (mem == NULL) { | ||
1542 | error = -ENOMEM; | 1533 | error = -ENOMEM; |
1543 | goto out_mptsas_probe; | 1534 | goto out_mptsas_probe; |
1544 | } | 1535 | } |
1545 | 1536 | ||
1546 | memset(mem, 0, sz); | 1537 | dprintk((KERN_INFO " vtarget @ %p\n", hd->Targets)); |
1547 | hd->Targets = (VirtTarget **) mem; | ||
1548 | |||
1549 | dprintk((KERN_INFO | ||
1550 | " vtarget @ %p, sz=%d\n", hd->Targets, sz)); | ||
1551 | 1538 | ||
1552 | /* Clear the TM flags | 1539 | /* Clear the TM flags |
1553 | */ | 1540 | */ |