summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_discover.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsas/sas_discover.c')
-rw-r--r--drivers/scsi/libsas/sas_discover.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index b6ba0e053d1..a65598b1e53 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -577,8 +577,6 @@ int sas_discover_sata(struct domain_device *dev)
out_err:
sas_notify_lldd_dev_gone(dev);
out_err2:
- sas_rphy_free(dev->rphy);
- dev->rphy = NULL;
return res;
}
@@ -600,24 +598,11 @@ int sas_discover_end_dev(struct domain_device *dev)
if (res)
goto out_err;
- /* do this to get the end device port attributes which will have
- * been scanned in sas_rphy_add */
- sas_notify_lldd_dev_gone(dev);
- res = sas_notify_lldd_dev_found(dev);
- if (res)
- goto out_err3;
-
return 0;
out_err:
sas_notify_lldd_dev_gone(dev);
out_err2:
- sas_rphy_free(dev->rphy);
- dev->rphy = NULL;
- return res;
-out_err3:
- sas_rphy_delete(dev->rphy);
- dev->rphy = NULL;
return res;
}
@@ -672,6 +657,7 @@ void sas_unregister_domain_devices(struct asd_sas_port *port)
*/
static void sas_discover_domain(struct work_struct *work)
{
+ struct domain_device *dev;
int error = 0;
struct sas_discovery_event *ev =
container_of(work, struct sas_discovery_event, work);
@@ -681,39 +667,42 @@ static void sas_discover_domain(struct work_struct *work)
&port->disc.pending);
if (port->port_dev)
- return ;
- else {
- error = sas_get_port_device(port);
- if (error)
- return;
- }
+ return;
+
+ error = sas_get_port_device(port);
+ if (error)
+ return;
+ dev = port->port_dev;
SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id,
current->pid);
- switch (port->port_dev->dev_type) {
+ switch (dev->dev_type) {
case SAS_END_DEV:
- error = sas_discover_end_dev(port->port_dev);
+ error = sas_discover_end_dev(dev);
break;
case EDGE_DEV:
case FANOUT_DEV:
- error = sas_discover_root_expander(port->port_dev);
+ error = sas_discover_root_expander(dev);
break;
case SATA_DEV:
case SATA_PM:
- error = sas_discover_sata(port->port_dev);
+ error = sas_discover_sata(dev);
break;
default:
- SAS_DPRINTK("unhandled device %d\n", port->port_dev->dev_type);
+ SAS_DPRINTK("unhandled device %d\n", dev->dev_type);
break;
}
if (error) {
+ sas_rphy_free(dev->rphy);
+ dev->rphy = NULL;
+
spin_lock(&port->dev_list_lock);
- list_del_init(&port->port_dev->dev_list_node);
+ list_del_init(&dev->dev_list_node);
spin_unlock(&port->dev_list_lock);
- kfree(port->port_dev); /* not kobject_register-ed yet */
+ kfree(dev); /* not kobject_register-ed yet */
port->port_dev = NULL;
}