diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-09-23 00:44:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-23 01:17:36 -0400 |
commit | 0cdc82ee1ae36c1ae4631fc3a782faeb0b90df38 (patch) | |
tree | 38dbeb4253338f25392c074a5e289c74e0b7ee9c /drivers/scsi | |
parent | 98b4f5929ce5e616d0d0e13c71baf50083ab7397 (diff) |
[PATCH] mesh scsi: fix error handling
The PowerMac mesh SCSI driver had some missing error handling which would
trigger warnings due to lack of handling of return value from
scsi_add_host. This fixes it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/mesh.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index a4857db4f9b8..b235556b7b65 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1959,22 +1959,35 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) | |||
1959 | /* Set it up */ | 1959 | /* Set it up */ |
1960 | mesh_init(ms); | 1960 | mesh_init(ms); |
1961 | 1961 | ||
1962 | /* XXX FIXME: error should be fatal */ | 1962 | /* Request interrupt */ |
1963 | if (request_irq(ms->meshintr, do_mesh_interrupt, 0, "MESH", ms)) | 1963 | if (request_irq(ms->meshintr, do_mesh_interrupt, 0, "MESH", ms)) { |
1964 | printk(KERN_ERR "MESH: can't get irq %d\n", ms->meshintr); | 1964 | printk(KERN_ERR "MESH: can't get irq %d\n", ms->meshintr); |
1965 | goto out_shutdown; | ||
1966 | } | ||
1965 | 1967 | ||
1966 | /* XXX FIXME: handle failure */ | 1968 | /* Add scsi host & scan */ |
1967 | scsi_add_host(mesh_host, &mdev->ofdev.dev); | 1969 | if (scsi_add_host(mesh_host, &mdev->ofdev.dev)) |
1970 | goto out_release_irq; | ||
1968 | scsi_scan_host(mesh_host); | 1971 | scsi_scan_host(mesh_host); |
1969 | 1972 | ||
1970 | return 0; | 1973 | return 0; |
1971 | 1974 | ||
1972 | out_unmap: | 1975 | out_release_irq: |
1976 | free_irq(ms->meshintr, ms); | ||
1977 | out_shutdown: | ||
1978 | /* shutdown & reset bus in case of error or macos can be confused | ||
1979 | * at reboot if the bus was set to synchronous mode already | ||
1980 | */ | ||
1981 | mesh_shutdown(mdev); | ||
1982 | set_mesh_power(ms, 0); | ||
1983 | pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, | ||
1984 | ms->dma_cmd_space, ms->dma_cmd_bus); | ||
1985 | out_unmap: | ||
1973 | iounmap(ms->dma); | 1986 | iounmap(ms->dma); |
1974 | iounmap(ms->mesh); | 1987 | iounmap(ms->mesh); |
1975 | out_free: | 1988 | out_free: |
1976 | scsi_host_put(mesh_host); | 1989 | scsi_host_put(mesh_host); |
1977 | out_release: | 1990 | out_release: |
1978 | macio_release_resources(mdev); | 1991 | macio_release_resources(mdev); |
1979 | 1992 | ||
1980 | return -ENODEV; | 1993 | return -ENODEV; |
@@ -2001,7 +2014,7 @@ static int mesh_remove(struct macio_dev *mdev) | |||
2001 | 2014 | ||
2002 | /* Free DMA commands memory */ | 2015 | /* Free DMA commands memory */ |
2003 | pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, | 2016 | pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, |
2004 | ms->dma_cmd_space, ms->dma_cmd_bus); | 2017 | ms->dma_cmd_space, ms->dma_cmd_bus); |
2005 | 2018 | ||
2006 | /* Release memory resources */ | 2019 | /* Release memory resources */ |
2007 | macio_release_resources(mdev); | 2020 | macio_release_resources(mdev); |