diff options
Diffstat (limited to 'drivers/scsi/mac53c94.c')
| -rw-r--r-- | drivers/scsi/mac53c94.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 932dcf0366eb..311a4122bd70 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
| @@ -432,11 +432,12 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
| 432 | struct Scsi_Host *host; | 432 | struct Scsi_Host *host; |
| 433 | void *dma_cmd_space; | 433 | void *dma_cmd_space; |
| 434 | unsigned char *clkprop; | 434 | unsigned char *clkprop; |
| 435 | int proplen; | 435 | int proplen, rc = -ENODEV; |
| 436 | 436 | ||
| 437 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { | 437 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { |
| 438 | printk(KERN_ERR "mac53c94: expected 2 addrs and intrs (got %d/%d)\n", | 438 | printk(KERN_ERR "mac53c94: expected 2 addrs and intrs" |
| 439 | node->n_addrs, node->n_intrs); | 439 | " (got %d/%d)\n", |
| 440 | macio_resource_count(mdev), macio_irq_count(mdev)); | ||
| 440 | return -ENODEV; | 441 | return -ENODEV; |
| 441 | } | 442 | } |
| 442 | 443 | ||
| @@ -448,6 +449,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
| 448 | host = scsi_host_alloc(&mac53c94_template, sizeof(struct fsc_state)); | 449 | host = scsi_host_alloc(&mac53c94_template, sizeof(struct fsc_state)); |
| 449 | if (host == NULL) { | 450 | if (host == NULL) { |
| 450 | printk(KERN_ERR "mac53c94: couldn't register host"); | 451 | printk(KERN_ERR "mac53c94: couldn't register host"); |
| 452 | rc = -ENOMEM; | ||
| 451 | goto out_release; | 453 | goto out_release; |
| 452 | } | 454 | } |
| 453 | 455 | ||
| @@ -486,6 +488,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
| 486 | if (dma_cmd_space == 0) { | 488 | if (dma_cmd_space == 0) { |
| 487 | printk(KERN_ERR "mac53c94: couldn't allocate dma " | 489 | printk(KERN_ERR "mac53c94: couldn't allocate dma " |
| 488 | "command space for %s\n", node->full_name); | 490 | "command space for %s\n", node->full_name); |
| 491 | rc = -ENOMEM; | ||
| 489 | goto out_free; | 492 | goto out_free; |
| 490 | } | 493 | } |
| 491 | state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space); | 494 | state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space); |
| @@ -495,18 +498,21 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
| 495 | 498 | ||
| 496 | mac53c94_init(state); | 499 | mac53c94_init(state); |
| 497 | 500 | ||
| 498 | if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94", state)) { | 501 | if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94",state)) { |
| 499 | printk(KERN_ERR "mac53C94: can't get irq %d for %s\n", | 502 | printk(KERN_ERR "mac53C94: can't get irq %d for %s\n", |
| 500 | state->intr, node->full_name); | 503 | state->intr, node->full_name); |
| 501 | goto out_free_dma; | 504 | goto out_free_dma; |
| 502 | } | 505 | } |
| 503 | 506 | ||
| 504 | /* XXX FIXME: handle failure */ | 507 | rc = scsi_add_host(host, &mdev->ofdev.dev); |
| 505 | scsi_add_host(host, &mdev->ofdev.dev); | 508 | if (rc != 0) |
| 506 | scsi_scan_host(host); | 509 | goto out_release_irq; |
| 507 | 510 | ||
| 511 | scsi_scan_host(host); | ||
| 508 | return 0; | 512 | return 0; |
| 509 | 513 | ||
| 514 | out_release_irq: | ||
| 515 | free_irq(state->intr, state); | ||
| 510 | out_free_dma: | 516 | out_free_dma: |
| 511 | kfree(state->dma_cmd_space); | 517 | kfree(state->dma_cmd_space); |
| 512 | out_free: | 518 | out_free: |
| @@ -518,7 +524,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
| 518 | out_release: | 524 | out_release: |
| 519 | macio_release_resources(mdev); | 525 | macio_release_resources(mdev); |
| 520 | 526 | ||
| 521 | return -ENODEV; | 527 | return rc; |
| 522 | } | 528 | } |
| 523 | 529 | ||
| 524 | static int mac53c94_remove(struct macio_dev *mdev) | 530 | static int mac53c94_remove(struct macio_dev *mdev) |
