aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptfc.c
diff options
context:
space:
mode:
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 */