diff options
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 833bea067a77..37c3c3f5f35d 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -783,6 +783,7 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
783 | sas_init_dev(child); | 783 | sas_init_dev(child); |
784 | 784 | ||
785 | child->rphy = rphy; | 785 | child->rphy = rphy; |
786 | get_device(&rphy->dev); | ||
786 | 787 | ||
787 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 788 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
788 | 789 | ||
@@ -806,6 +807,7 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
806 | sas_init_dev(child); | 807 | sas_init_dev(child); |
807 | 808 | ||
808 | child->rphy = rphy; | 809 | child->rphy = rphy; |
810 | get_device(&rphy->dev); | ||
809 | sas_fill_in_rphy(child, rphy); | 811 | sas_fill_in_rphy(child, rphy); |
810 | 812 | ||
811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 813 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
@@ -830,8 +832,6 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
830 | 832 | ||
831 | out_list_del: | 833 | out_list_del: |
832 | sas_rphy_free(child->rphy); | 834 | sas_rphy_free(child->rphy); |
833 | child->rphy = NULL; | ||
834 | |||
835 | list_del(&child->disco_list_node); | 835 | list_del(&child->disco_list_node); |
836 | spin_lock_irq(&parent->port->dev_list_lock); | 836 | spin_lock_irq(&parent->port->dev_list_lock); |
837 | list_del(&child->dev_list_node); | 837 | list_del(&child->dev_list_node); |
@@ -911,6 +911,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
911 | } | 911 | } |
912 | port = parent->port; | 912 | port = parent->port; |
913 | child->rphy = rphy; | 913 | child->rphy = rphy; |
914 | get_device(&rphy->dev); | ||
914 | edev = rphy_to_expander_device(rphy); | 915 | edev = rphy_to_expander_device(rphy); |
915 | child->dev_type = phy->attached_dev_type; | 916 | child->dev_type = phy->attached_dev_type; |
916 | kref_get(&parent->kref); | 917 | kref_get(&parent->kref); |
@@ -934,6 +935,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
934 | 935 | ||
935 | res = sas_discover_expander(child); | 936 | res = sas_discover_expander(child); |
936 | if (res) { | 937 | if (res) { |
938 | sas_rphy_delete(rphy); | ||
937 | spin_lock_irq(&parent->port->dev_list_lock); | 939 | spin_lock_irq(&parent->port->dev_list_lock); |
938 | list_del(&child->dev_list_node); | 940 | list_del(&child->dev_list_node); |
939 | spin_unlock_irq(&parent->port->dev_list_lock); | 941 | spin_unlock_irq(&parent->port->dev_list_lock); |