diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-04 06:19:18 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-10-04 14:17:47 -0400 |
commit | bb0766204c81d6bd01532476aec4e512c960fb4d (patch) | |
tree | a0151d2b3b2c62079e0b620da43deed6badd46ff | |
parent | 13026a6b985b9d1e19330d5656e211f15b5aca3b (diff) |
[SCSI] SCSI aic94xx: handle sysfs errors
Handle and unwind from errors returned by driver model functions.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_init.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index ee2ccad70487..57379c929d87 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
@@ -310,11 +310,29 @@ static ssize_t asd_show_dev_pcba_sn(struct device *dev, | |||
310 | } | 310 | } |
311 | static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL); | 311 | static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL); |
312 | 312 | ||
313 | static void asd_create_dev_attrs(struct asd_ha_struct *asd_ha) | 313 | static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha) |
314 | { | 314 | { |
315 | device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 315 | int err; |
316 | device_create_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | 316 | |
317 | device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); | 317 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); |
318 | if (err) | ||
319 | return err; | ||
320 | |||
321 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | ||
322 | if (err) | ||
323 | goto err_rev; | ||
324 | |||
325 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); | ||
326 | if (err) | ||
327 | goto err_biosb; | ||
328 | |||
329 | return 0; | ||
330 | |||
331 | err_biosb: | ||
332 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | ||
333 | err_rev: | ||
334 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); | ||
335 | return err; | ||
318 | } | 336 | } |
319 | 337 | ||
320 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) | 338 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) |
@@ -646,7 +664,9 @@ static int __devinit asd_pci_probe(struct pci_dev *dev, | |||
646 | } | 664 | } |
647 | ASD_DPRINTK("escbs posted\n"); | 665 | ASD_DPRINTK("escbs posted\n"); |
648 | 666 | ||
649 | asd_create_dev_attrs(asd_ha); | 667 | err = asd_create_dev_attrs(asd_ha); |
668 | if (err) | ||
669 | goto Err_dev_attrs; | ||
650 | 670 | ||
651 | err = asd_register_sas_ha(asd_ha); | 671 | err = asd_register_sas_ha(asd_ha); |
652 | if (err) | 672 | if (err) |
@@ -669,6 +689,7 @@ Err_en_phys: | |||
669 | asd_unregister_sas_ha(asd_ha); | 689 | asd_unregister_sas_ha(asd_ha); |
670 | Err_reg_sas: | 690 | Err_reg_sas: |
671 | asd_remove_dev_attrs(asd_ha); | 691 | asd_remove_dev_attrs(asd_ha); |
692 | Err_dev_attrs: | ||
672 | Err_escbs: | 693 | Err_escbs: |
673 | asd_disable_ints(asd_ha); | 694 | asd_disable_ints(asd_ha); |
674 | free_irq(dev->irq, asd_ha); | 695 | free_irq(dev->irq, asd_ha); |
@@ -755,9 +776,9 @@ static ssize_t asd_version_show(struct device_driver *driver, char *buf) | |||
755 | } | 776 | } |
756 | static DRIVER_ATTR(version, S_IRUGO, asd_version_show, NULL); | 777 | static DRIVER_ATTR(version, S_IRUGO, asd_version_show, NULL); |
757 | 778 | ||
758 | static void asd_create_driver_attrs(struct device_driver *driver) | 779 | static int asd_create_driver_attrs(struct device_driver *driver) |
759 | { | 780 | { |
760 | driver_create_file(driver, &driver_attr_version); | 781 | return driver_create_file(driver, &driver_attr_version); |
761 | } | 782 | } |
762 | 783 | ||
763 | static void asd_remove_driver_attrs(struct device_driver *driver) | 784 | static void asd_remove_driver_attrs(struct device_driver *driver) |
@@ -835,10 +856,14 @@ static int __init aic94xx_init(void) | |||
835 | if (err) | 856 | if (err) |
836 | goto out_release_transport; | 857 | goto out_release_transport; |
837 | 858 | ||
838 | asd_create_driver_attrs(&aic94xx_pci_driver.driver); | 859 | err = asd_create_driver_attrs(&aic94xx_pci_driver.driver); |
860 | if (err) | ||
861 | goto out_unregister_pcidrv; | ||
839 | 862 | ||
840 | return err; | 863 | return err; |
841 | 864 | ||
865 | out_unregister_pcidrv: | ||
866 | pci_unregister_driver(&aic94xx_pci_driver); | ||
842 | out_release_transport: | 867 | out_release_transport: |
843 | sas_release_transport(aic94xx_transport_template); | 868 | sas_release_transport(aic94xx_transport_template); |
844 | out_destroy_caches: | 869 | out_destroy_caches: |