Commit 37c48f0b authored by Bart Van Assche's avatar Bart Van Assche Committed by Kamal Mostafa

IB/srp: Remove an extraneous scsi_host_put() from an error path

commit fb49c8bb upstream.

Fix a scsi_get_host() / scsi_host_put() imbalance in the error
path of srp_create_target(). See also patch "IB/srp: Avoid that
I/O hangs due to a cable pull during LUN scanning" (commit ID
34aa654e).
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 237ffdd6
...@@ -3171,11 +3171,11 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3171,11 +3171,11 @@ static ssize_t srp_create_target(struct device *dev,
ret = srp_parse_options(buf, target); ret = srp_parse_options(buf, target);
if (ret) if (ret)
goto err; goto out;
ret = scsi_init_shared_tag_map(target_host, target_host->can_queue); ret = scsi_init_shared_tag_map(target_host, target_host->can_queue);
if (ret) if (ret)
goto err; goto out;
target->req_ring_size = target->queue_size - SRP_TSK_MGMT_SQ_SIZE; target->req_ring_size = target->queue_size - SRP_TSK_MGMT_SQ_SIZE;
...@@ -3186,7 +3186,7 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3186,7 +3186,7 @@ static ssize_t srp_create_target(struct device *dev,
be64_to_cpu(target->ioc_guid), be64_to_cpu(target->ioc_guid),
be64_to_cpu(target->initiator_ext)); be64_to_cpu(target->initiator_ext));
ret = -EEXIST; ret = -EEXIST;
goto err; goto out;
} }
if (!srp_dev->has_fmr && !srp_dev->has_fr && !target->allow_ext_sg && if (!srp_dev->has_fmr && !srp_dev->has_fr && !target->allow_ext_sg &&
...@@ -3207,7 +3207,7 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3207,7 +3207,7 @@ static ssize_t srp_create_target(struct device *dev,
spin_lock_init(&target->lock); spin_lock_init(&target->lock);
ret = ib_query_gid(ibdev, host->port, 0, &target->sgid); ret = ib_query_gid(ibdev, host->port, 0, &target->sgid);
if (ret) if (ret)
goto err; goto out;
ret = -ENOMEM; ret = -ENOMEM;
target->ch_count = max_t(unsigned, num_online_nodes(), target->ch_count = max_t(unsigned, num_online_nodes(),
...@@ -3218,7 +3218,7 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3218,7 +3218,7 @@ static ssize_t srp_create_target(struct device *dev,
target->ch = kcalloc(target->ch_count, sizeof(*target->ch), target->ch = kcalloc(target->ch_count, sizeof(*target->ch),
GFP_KERNEL); GFP_KERNEL);
if (!target->ch) if (!target->ch)
goto err; goto out;
node_idx = 0; node_idx = 0;
for_each_online_node(node) { for_each_online_node(node) {
...@@ -3314,9 +3314,6 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3314,9 +3314,6 @@ static ssize_t srp_create_target(struct device *dev,
} }
kfree(target->ch); kfree(target->ch);
err:
scsi_host_put(target_host);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment