diff options
Diffstat (limited to 'drivers/message/fusion/mptspi.c')
| -rw-r--r-- | drivers/message/fusion/mptspi.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index ce332a6085e5..7dce29277cb7 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
| @@ -158,11 +158,10 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 158 | MPT_SCSI_HOST *hd; | 158 | MPT_SCSI_HOST *hd; |
| 159 | MPT_ADAPTER *ioc; | 159 | MPT_ADAPTER *ioc; |
| 160 | unsigned long flags; | 160 | unsigned long flags; |
| 161 | int sz, ii; | 161 | int ii; |
| 162 | int numSGE = 0; | 162 | int numSGE = 0; |
| 163 | int scale; | 163 | int scale; |
| 164 | int ioc_cap; | 164 | int ioc_cap; |
| 165 | u8 *mem; | ||
| 166 | int error=0; | 165 | int error=0; |
| 167 | int r; | 166 | int r; |
| 168 | 167 | ||
| @@ -288,36 +287,27 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 288 | /* SCSI needs scsi_cmnd lookup table! | 287 | /* SCSI needs scsi_cmnd lookup table! |
| 289 | * (with size equal to req_depth*PtrSz!) | 288 | * (with size equal to req_depth*PtrSz!) |
| 290 | */ | 289 | */ |
| 291 | sz = ioc->req_depth * sizeof(void *); | 290 | hd->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC); |
| 292 | mem = kmalloc(sz, GFP_ATOMIC); | 291 | if (!hd->ScsiLookup) { |
| 293 | if (mem == NULL) { | ||
| 294 | error = -ENOMEM; | 292 | error = -ENOMEM; |
| 295 | goto out_mptspi_probe; | 293 | goto out_mptspi_probe; |
| 296 | } | 294 | } |
| 297 | 295 | ||
| 298 | memset(mem, 0, sz); | 296 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", |
| 299 | hd->ScsiLookup = (struct scsi_cmnd **) mem; | 297 | ioc->name, hd->ScsiLookup)); |
| 300 | |||
| 301 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p, sz=%d\n", | ||
| 302 | ioc->name, hd->ScsiLookup, sz)); | ||
| 303 | 298 | ||
| 304 | /* Allocate memory for the device structures. | 299 | /* Allocate memory for the device structures. |
| 305 | * A non-Null pointer at an offset | 300 | * A non-Null pointer at an offset |
| 306 | * indicates a device exists. | 301 | * indicates a device exists. |
| 307 | * max_id = 1 + maximum id (hosts.h) | 302 | * max_id = 1 + maximum id (hosts.h) |
| 308 | */ | 303 | */ |
| 309 | sz = sh->max_id * sizeof(void *); | 304 | hd->Targets = kcalloc(sh->max_id, sizeof(void *), GFP_ATOMIC); |
| 310 | mem = kmalloc(sz, GFP_ATOMIC); | 305 | if (!hd->Targets) { |
| 311 | if (mem == NULL) { | ||
| 312 | error = -ENOMEM; | 306 | error = -ENOMEM; |
| 313 | goto out_mptspi_probe; | 307 | goto out_mptspi_probe; |
| 314 | } | 308 | } |
| 315 | 309 | ||
| 316 | memset(mem, 0, sz); | 310 | dprintk((KERN_INFO " vdev @ %p\n", hd->Targets)); |
| 317 | hd->Targets = (VirtTarget **) mem; | ||
| 318 | |||
| 319 | dprintk((KERN_INFO | ||
| 320 | " vdev @ %p, sz=%d\n", hd->Targets, sz)); | ||
| 321 | 311 | ||
| 322 | /* Clear the TM flags | 312 | /* Clear the TM flags |
| 323 | */ | 313 | */ |
