aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic94xx/aic94xx_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic94xx/aic94xx_init.c')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 734adc9d5206..99743ca29ca1 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -309,11 +309,29 @@ static ssize_t asd_show_dev_pcba_sn(struct device *dev,
309} 309}
310static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL); 310static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL);
311 311
312static void asd_create_dev_attrs(struct asd_ha_struct *asd_ha) 312static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
313{ 313{
314 device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); 314 int err;
315 device_create_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); 315
316 device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); 316 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision);
317 if (err)
318 return err;
319
320 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
321 if (err)
322 goto err_rev;
323
324 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
325 if (err)
326 goto err_biosb;
327
328 return 0;
329
330err_biosb:
331 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
332err_rev:
333 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
334 return err;
317} 335}
318 336
319static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) 337static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
@@ -645,7 +663,9 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
645 } 663 }
646 ASD_DPRINTK("escbs posted\n"); 664 ASD_DPRINTK("escbs posted\n");
647 665
648 asd_create_dev_attrs(asd_ha); 666 err = asd_create_dev_attrs(asd_ha);
667 if (err)
668 goto Err_dev_attrs;
649 669
650 err = asd_register_sas_ha(asd_ha); 670 err = asd_register_sas_ha(asd_ha);
651 if (err) 671 if (err)
@@ -668,6 +688,7 @@ Err_en_phys:
668 asd_unregister_sas_ha(asd_ha); 688 asd_unregister_sas_ha(asd_ha);
669Err_reg_sas: 689Err_reg_sas:
670 asd_remove_dev_attrs(asd_ha); 690 asd_remove_dev_attrs(asd_ha);
691Err_dev_attrs:
671Err_escbs: 692Err_escbs:
672 asd_disable_ints(asd_ha); 693 asd_disable_ints(asd_ha);
673 free_irq(dev->irq, asd_ha); 694 free_irq(dev->irq, asd_ha);
@@ -754,9 +775,9 @@ static ssize_t asd_version_show(struct device_driver *driver, char *buf)
754} 775}
755static DRIVER_ATTR(version, S_IRUGO, asd_version_show, NULL); 776static DRIVER_ATTR(version, S_IRUGO, asd_version_show, NULL);
756 777
757static void asd_create_driver_attrs(struct device_driver *driver) 778static int asd_create_driver_attrs(struct device_driver *driver)
758{ 779{
759 driver_create_file(driver, &driver_attr_version); 780 return driver_create_file(driver, &driver_attr_version);
760} 781}
761 782
762static void asd_remove_driver_attrs(struct device_driver *driver) 783static void asd_remove_driver_attrs(struct device_driver *driver)
@@ -834,10 +855,14 @@ static int __init aic94xx_init(void)
834 if (err) 855 if (err)
835 goto out_release_transport; 856 goto out_release_transport;
836 857
837 asd_create_driver_attrs(&aic94xx_pci_driver.driver); 858 err = asd_create_driver_attrs(&aic94xx_pci_driver.driver);
859 if (err)
860 goto out_unregister_pcidrv;
838 861
839 return err; 862 return err;
840 863
864 out_unregister_pcidrv:
865 pci_unregister_driver(&aic94xx_pci_driver);
841 out_release_transport: 866 out_release_transport:
842 sas_release_transport(aic94xx_transport_template); 867 sas_release_transport(aic94xx_transport_template);
843 out_destroy_caches: 868 out_destroy_caches: