aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-02-04 09:41:59 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-02-17 14:18:10 -0500
commitecd9aad402765abce04a96b8d1ed15163ca6c8a1 (patch)
treecac738fe8dfb44ebc9e958fb1c7659a19d80ddc7 /drivers/scsi/hpsa.c
parentbcc4425548ada73475606c9c5d7cfce7eae0eb64 (diff)
[SCSI] hpsa: return proper error codes not minus one.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9017e640e799..8389ccefd106 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1130,11 +1130,11 @@ static int hpsa_scsi_detect(struct ctlr_info *h)
1130 dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_add_host" 1130 dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_add_host"
1131 " failed for controller %d\n", h->ctlr); 1131 " failed for controller %d\n", h->ctlr);
1132 scsi_host_put(sh); 1132 scsi_host_put(sh);
1133 return -1; 1133 return error;
1134 fail: 1134 fail:
1135 dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_host_alloc" 1135 dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_host_alloc"
1136 " failed for controller %d\n", h->ctlr); 1136 " failed for controller %d\n", h->ctlr);
1137 return -1; 1137 return -ENOMEM;
1138} 1138}
1139 1139
1140static void hpsa_pci_unmap(struct pci_dev *pdev, 1140static void hpsa_pci_unmap(struct pci_dev *pdev,
@@ -1271,7 +1271,7 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
1271 1271
1272 if (c == NULL) { /* trouble... */ 1272 if (c == NULL) { /* trouble... */
1273 dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n"); 1273 dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
1274 return -1; 1274 return -ENOMEM;
1275 } 1275 }
1276 1276
1277 fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize, page, scsi3addr, TYPE_CMD); 1277 fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize, page, scsi3addr, TYPE_CMD);
@@ -3284,7 +3284,7 @@ err_out_free_res:
3284static int __devinit hpsa_init_one(struct pci_dev *pdev, 3284static int __devinit hpsa_init_one(struct pci_dev *pdev,
3285 const struct pci_device_id *ent) 3285 const struct pci_device_id *ent)
3286{ 3286{
3287 int i; 3287 int i, rc;
3288 int dac; 3288 int dac;
3289 struct ctlr_info *h; 3289 struct ctlr_info *h;
3290 3290
@@ -3312,14 +3312,15 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
3312 BUILD_BUG_ON(sizeof(struct CommandList) % 8); 3312 BUILD_BUG_ON(sizeof(struct CommandList) % 8);
3313 h = kzalloc(sizeof(*h), GFP_KERNEL); 3313 h = kzalloc(sizeof(*h), GFP_KERNEL);
3314 if (!h) 3314 if (!h)
3315 return -1; 3315 return -ENOMEM;
3316 3316
3317 h->busy_initializing = 1; 3317 h->busy_initializing = 1;
3318 INIT_HLIST_HEAD(&h->cmpQ); 3318 INIT_HLIST_HEAD(&h->cmpQ);
3319 INIT_HLIST_HEAD(&h->reqQ); 3319 INIT_HLIST_HEAD(&h->reqQ);
3320 mutex_init(&h->busy_shutting_down); 3320 mutex_init(&h->busy_shutting_down);
3321 init_completion(&h->scan_wait); 3321 init_completion(&h->scan_wait);
3322 if (hpsa_pci_init(h, pdev) != 0) 3322 rc = hpsa_pci_init(h, pdev);
3323 if (rc != 0)
3323 goto clean1; 3324 goto clean1;
3324 3325
3325 sprintf(h->devname, "hpsa%d", number_of_controllers); 3326 sprintf(h->devname, "hpsa%d", number_of_controllers);
@@ -3328,19 +3329,24 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
3328 h->pdev = pdev; 3329 h->pdev = pdev;
3329 3330
3330 /* configure PCI DMA stuff */ 3331 /* configure PCI DMA stuff */
3331 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) 3332 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
3333 if (rc == 0) {
3332 dac = 1; 3334 dac = 1;
3333 else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) 3335 } else {
3334 dac = 0; 3336 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
3335 else { 3337 if (rc == 0) {
3336 dev_err(&pdev->dev, "no suitable DMA available\n"); 3338 dac = 0;
3337 goto clean1; 3339 } else {
3340 dev_err(&pdev->dev, "no suitable DMA available\n");
3341 goto clean1;
3342 }
3338 } 3343 }
3339 3344
3340 /* make sure the board interrupts are off */ 3345 /* make sure the board interrupts are off */
3341 h->access.set_intr_mask(h, HPSA_INTR_OFF); 3346 h->access.set_intr_mask(h, HPSA_INTR_OFF);
3342 if (request_irq(h->intr[SIMPLE_MODE_INT], do_hpsa_intr, 3347 rc = request_irq(h->intr[SIMPLE_MODE_INT], do_hpsa_intr,
3343 IRQF_DISABLED | IRQF_SHARED, h->devname, h)) { 3348 IRQF_DISABLED | IRQF_SHARED, h->devname, h);
3349 if (rc) {
3344 dev_err(&pdev->dev, "unable to get irq %d for %s\n", 3350 dev_err(&pdev->dev, "unable to get irq %d for %s\n",
3345 h->intr[SIMPLE_MODE_INT], h->devname); 3351 h->intr[SIMPLE_MODE_INT], h->devname);
3346 goto clean2; 3352 goto clean2;
@@ -3363,6 +3369,7 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
3363 || (h->cmd_pool == NULL) 3369 || (h->cmd_pool == NULL)
3364 || (h->errinfo_pool == NULL)) { 3370 || (h->errinfo_pool == NULL)) {
3365 dev_err(&pdev->dev, "out of memory"); 3371 dev_err(&pdev->dev, "out of memory");
3372 rc = -ENOMEM;
3366 goto clean4; 3373 goto clean4;
3367 } 3374 }
3368 spin_lock_init(&h->lock); 3375 spin_lock_init(&h->lock);
@@ -3397,7 +3404,7 @@ clean2:
3397clean1: 3404clean1:
3398 h->busy_initializing = 0; 3405 h->busy_initializing = 0;
3399 kfree(h); 3406 kfree(h);
3400 return -1; 3407 return rc;
3401} 3408}
3402 3409
3403static void hpsa_flush_cache(struct ctlr_info *h) 3410static void hpsa_flush_cache(struct ctlr_info *h)