[PATCH 14/15] ib_srp: Introduce a temporary variable in srp_remove_target()

Bart Van Assche
2012-03-25T15:02:30Z

drivers/infiniband/ulp/srp/ib_srp.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 9f940a5..63f57fd 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -587,15 +587,17 @@ static void srp_del_scsi_host_attr(struct Scsi_Host *shost)

static void srp_remove_target(struct srp_target_port *target)
{
+ struct Scsi_Host *shost = target->scsi_host;
+
WARN_ON(target->state != SRP_TARGET_REMOVED);

- srp_del_scsi_host_attr(target->scsi_host);
- srp_remove_host(target->scsi_host);
- scsi_remove_host(target->scsi_host);
+ srp_del_scsi_host_attr(shost);
+ srp_remove_host(shost);
+ scsi_remove_host(shost);
srp_disconnect_target(target);
srp_free_target_ib(target);
srp_free_req_data(target);
- scsi_host_put(target->scsi_host);
+ scsi_host_put(shost);
}

static void srp_remove_work(struct work_struct *work)