diff options
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 83dd5070a15c..505ffe358293 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -175,10 +175,10 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, | |||
175 | switch (resp->result) { | 175 | switch (resp->result) { |
176 | case SMP_RESP_PHY_VACANT: | 176 | case SMP_RESP_PHY_VACANT: |
177 | phy->phy_state = PHY_VACANT; | 177 | phy->phy_state = PHY_VACANT; |
178 | return; | 178 | break; |
179 | default: | 179 | default: |
180 | phy->phy_state = PHY_NOT_PRESENT; | 180 | phy->phy_state = PHY_NOT_PRESENT; |
181 | return; | 181 | break; |
182 | case SMP_RESP_FUNC_ACC: | 182 | case SMP_RESP_FUNC_ACC: |
183 | phy->phy_state = PHY_EMPTY; /* do not know yet */ | 183 | phy->phy_state = PHY_EMPTY; /* do not know yet */ |
184 | break; | 184 | break; |
@@ -209,7 +209,10 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, | |||
209 | phy->phy->negotiated_linkrate = phy->linkrate; | 209 | phy->phy->negotiated_linkrate = phy->linkrate; |
210 | 210 | ||
211 | if (!rediscover) | 211 | if (!rediscover) |
212 | sas_phy_add(phy->phy); | 212 | if (sas_phy_add(phy->phy)) { |
213 | sas_phy_free(phy->phy); | ||
214 | return; | ||
215 | } | ||
213 | 216 | ||
214 | SAS_DPRINTK("ex %016llx phy%02d:%c attached: %016llx\n", | 217 | SAS_DPRINTK("ex %016llx phy%02d:%c attached: %016llx\n", |
215 | SAS_ADDR(dev->sas_addr), phy->phy_id, | 218 | SAS_ADDR(dev->sas_addr), phy->phy_id, |
@@ -1724,6 +1727,7 @@ static void sas_unregister_ex_tree(struct domain_device *dev) | |||
1724 | struct domain_device *child, *n; | 1727 | struct domain_device *child, *n; |
1725 | 1728 | ||
1726 | list_for_each_entry_safe(child, n, &ex->children, siblings) { | 1729 | list_for_each_entry_safe(child, n, &ex->children, siblings) { |
1730 | child->gone = 1; | ||
1727 | if (child->dev_type == EDGE_DEV || | 1731 | if (child->dev_type == EDGE_DEV || |
1728 | child->dev_type == FANOUT_DEV) | 1732 | child->dev_type == FANOUT_DEV) |
1729 | sas_unregister_ex_tree(child); | 1733 | sas_unregister_ex_tree(child); |
@@ -1744,6 +1748,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent, | |||
1744 | &ex_dev->children, siblings) { | 1748 | &ex_dev->children, siblings) { |
1745 | if (SAS_ADDR(child->sas_addr) == | 1749 | if (SAS_ADDR(child->sas_addr) == |
1746 | SAS_ADDR(phy->attached_sas_addr)) { | 1750 | SAS_ADDR(phy->attached_sas_addr)) { |
1751 | child->gone = 1; | ||
1747 | if (child->dev_type == EDGE_DEV || | 1752 | if (child->dev_type == EDGE_DEV || |
1748 | child->dev_type == FANOUT_DEV) | 1753 | child->dev_type == FANOUT_DEV) |
1749 | sas_unregister_ex_tree(child); | 1754 | sas_unregister_ex_tree(child); |
@@ -1752,6 +1757,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent, | |||
1752 | break; | 1757 | break; |
1753 | } | 1758 | } |
1754 | } | 1759 | } |
1760 | parent->gone = 1; | ||
1755 | sas_disable_routing(parent, phy->attached_sas_addr); | 1761 | sas_disable_routing(parent, phy->attached_sas_addr); |
1756 | } | 1762 | } |
1757 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | 1763 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); |