aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptfc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-01-13 12:27:50 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-14 11:54:58 -0500
commit1ca00bb7916cb40b8140173c23481e11d92d6f6a (patch)
treee5a16f6f230556ce43f77139c729f09a16ec95fb /drivers/message/fusion/mptfc.c
parenteeb846cefdd842af479393a7d0fd399a29e42532 (diff)
[SCSI] fusion: kzalloc / kcalloc conversion
Convert kmalloc + memset to kzalloc or kcalloc in fusion. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion/mptfc.c')
-rw-r--r--drivers/message/fusion/mptfc.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index ba61e1828858..5083a556a258 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -148,11 +148,10 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
148 MPT_SCSI_HOST *hd; 148 MPT_SCSI_HOST *hd;
149 MPT_ADAPTER *ioc; 149 MPT_ADAPTER *ioc;
150 unsigned long flags; 150 unsigned long flags;
151 int sz, ii; 151 int ii;
152 int numSGE = 0; 152 int numSGE = 0;
153 int scale; 153 int scale;
154 int ioc_cap; 154 int ioc_cap;
155 u8 *mem;
156 int error=0; 155 int error=0;
157 int r; 156 int r;
158 157
@@ -268,36 +267,27 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
268 /* SCSI needs scsi_cmnd lookup table! 267 /* SCSI needs scsi_cmnd lookup table!
269 * (with size equal to req_depth*PtrSz!) 268 * (with size equal to req_depth*PtrSz!)
270 */ 269 */
271 sz = ioc->req_depth * sizeof(void *); 270 hd->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC);
272 mem = kmalloc(sz, GFP_ATOMIC); 271 if (!hd->ScsiLookup) {
273 if (mem == NULL) {
274 error = -ENOMEM; 272 error = -ENOMEM;
275 goto out_mptfc_probe; 273 goto out_mptfc_probe;
276 } 274 }
277 275
278 memset(mem, 0, sz); 276 dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n",
279 hd->ScsiLookup = (struct scsi_cmnd **) mem; 277 ioc->name, hd->ScsiLookup));
280
281 dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p, sz=%d\n",
282 ioc->name, hd->ScsiLookup, sz));
283 278
284 /* Allocate memory for the device structures. 279 /* Allocate memory for the device structures.
285 * A non-Null pointer at an offset 280 * A non-Null pointer at an offset
286 * indicates a device exists. 281 * indicates a device exists.
287 * max_id = 1 + maximum id (hosts.h) 282 * max_id = 1 + maximum id (hosts.h)
288 */ 283 */
289 sz = sh->max_id * sizeof(void *); 284 hd->Targets = kcalloc(sh->max_id, sizeof(void *), GFP_ATOMIC);
290 mem = kmalloc(sz, GFP_ATOMIC); 285 if (!hd->Targets) {
291 if (mem == NULL) {
292 error = -ENOMEM; 286 error = -ENOMEM;
293 goto out_mptfc_probe; 287 goto out_mptfc_probe;
294 } 288 }
295 289
296 memset(mem, 0, sz); 290 dprintk((KERN_INFO " vdev @ %p\n", hd->Targets));
297 hd->Targets = (VirtTarget **) mem;
298
299 dprintk((KERN_INFO
300 " vdev @ %p, sz=%d\n", hd->Targets, sz));
301 291
302 /* Clear the TM flags 292 /* Clear the TM flags
303 */ 293 */