aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ieee1394/sbp2.c57
1 files changed, 7 insertions, 50 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 14b0c35ee9a4..18d7eda38851 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -856,56 +856,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
856 pci_alloc_consistent(hi->host->pdev, 856 pci_alloc_consistent(hi->host->pdev,
857 sizeof(struct sbp2_login_orb), 857 sizeof(struct sbp2_login_orb),
858 &scsi_id->login_orb_dma); 858 &scsi_id->login_orb_dma);
859 if (!scsi_id->login_orb) { 859 if (!scsi_id->login_orb)
860alloc_fail: 860 goto alloc_fail;
861 if (scsi_id->query_logins_response) {
862 pci_free_consistent(hi->host->pdev,
863 sizeof(struct sbp2_query_logins_response),
864 scsi_id->query_logins_response,
865 scsi_id->query_logins_response_dma);
866 SBP2_DMA_FREE("query logins response DMA");
867 }
868
869 if (scsi_id->query_logins_orb) {
870 pci_free_consistent(hi->host->pdev,
871 sizeof(struct sbp2_query_logins_orb),
872 scsi_id->query_logins_orb,
873 scsi_id->query_logins_orb_dma);
874 SBP2_DMA_FREE("query logins ORB DMA");
875 }
876
877 if (scsi_id->logout_orb) {
878 pci_free_consistent(hi->host->pdev,
879 sizeof(struct sbp2_logout_orb),
880 scsi_id->logout_orb,
881 scsi_id->logout_orb_dma);
882 SBP2_DMA_FREE("logout ORB DMA");
883 }
884
885 if (scsi_id->reconnect_orb) {
886 pci_free_consistent(hi->host->pdev,
887 sizeof(struct sbp2_reconnect_orb),
888 scsi_id->reconnect_orb,
889 scsi_id->reconnect_orb_dma);
890 SBP2_DMA_FREE("reconnect ORB DMA");
891 }
892
893 if (scsi_id->login_response) {
894 pci_free_consistent(hi->host->pdev,
895 sizeof(struct sbp2_login_response),
896 scsi_id->login_response,
897 scsi_id->login_response_dma);
898 SBP2_DMA_FREE("login FIFO DMA");
899 }
900
901 list_del(&scsi_id->scsi_list);
902
903 kfree(scsi_id);
904
905 SBP2_ERR("Could not allocate memory for scsi_id");
906
907 return -ENOMEM;
908 }
909 SBP2_DMA_ALLOC("consistent DMA region for login ORB"); 861 SBP2_DMA_ALLOC("consistent DMA region for login ORB");
910 862
911 SBP2_DEBUG("New SBP-2 device inserted, SCSI ID = %x", scsi_id->ud->id); 863 SBP2_DEBUG("New SBP-2 device inserted, SCSI ID = %x", scsi_id->ud->id);
@@ -966,6 +918,11 @@ alloc_fail:
966 } 918 }
967 919
968 return 0; 920 return 0;
921
922alloc_fail:
923 SBP2_ERR("Could not allocate memory for scsi_id");
924 sbp2_remove_device(scsi_id);
925 return -ENOMEM;
969} 926}
970 927
971/* 928/*