diff mbox

[4/8] IB/srp: Move ib_destroy_cm_id() call into srp_free_ch_ib()

Message ID 541C285B.5010309@acm.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bart Van Assche Sept. 19, 2014, 12:58 p.m. UTC
The patch that adds multichannel support into the SRP initiator
driver introduces an additional call to srp_free_ch_ib(). This
patch helps to keep that later patch simple.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Sagi Grimberg Sept. 19, 2014, 6:10 p.m. UTC | #1
On 9/19/2014 3:58 PM, Bart Van Assche wrote:
> The patch that adds multichannel support into the SRP initiator
> driver introduces an additional call to srp_free_ch_ib(). This
> patch helps to keep that later patch simple.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 62d2a18..d3c712f 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -555,6 +555,11 @@ static void srp_free_target_ib(struct srp_target_port *target)
>   struct srp_device *dev = target->srp_host->srp_dev;
>   int i;
>
> + if (target->cm_id) {
> + ib_destroy_cm_id(target->cm_id);
> + target->cm_id = NULL;
> + }
> +
>   if (dev->use_fast_reg) {
>   if (target->fr_pool)
>   srp_destroy_fr_pool(target->fr_pool);
> @@ -868,7 +873,6 @@ static void srp_remove_target(struct srp_target_port *target)
>   scsi_remove_host(target->scsi_host);
>   srp_stop_rport_timers(target->rport);
>   srp_disconnect_target(target);
> - ib_destroy_cm_id(target->cm_id);
>   srp_free_target_ib(target);
>   cancel_work_sync(&target->tl_err_work);
>   srp_rport_put(target->rport);
> @@ -3043,7 +3047,7 @@ static ssize_t srp_create_target(struct device *dev,
>   if (ret) {
>   shost_printk(KERN_ERR, target->scsi_host,
>       PFX "Connection failed\n");
> - goto err_cm_id;
> + goto err_free_ib;
>   }
>
>   ret = srp_add_target(host, target);
> @@ -3067,9 +3071,6 @@ out:
>   err_disconnect:
>   srp_disconnect_target(target);
>
> -err_cm_id:
> - ib_destroy_cm_id(target->cm_id);
> -
>   err_free_ib:
>   srp_free_target_ib(target);
>
>

Looks good.

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 62d2a18..d3c712f 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -555,6 +555,11 @@  static void srp_free_target_ib(struct srp_target_port *target)
 	struct srp_device *dev = target->srp_host->srp_dev;
 	int i;
 
+	if (target->cm_id) {
+		ib_destroy_cm_id(target->cm_id);
+		target->cm_id = NULL;
+	}
+
 	if (dev->use_fast_reg) {
 		if (target->fr_pool)
 			srp_destroy_fr_pool(target->fr_pool);
@@ -868,7 +873,6 @@  static void srp_remove_target(struct srp_target_port *target)
 	scsi_remove_host(target->scsi_host);
 	srp_stop_rport_timers(target->rport);
 	srp_disconnect_target(target);
-	ib_destroy_cm_id(target->cm_id);
 	srp_free_target_ib(target);
 	cancel_work_sync(&target->tl_err_work);
 	srp_rport_put(target->rport);
@@ -3043,7 +3047,7 @@  static ssize_t srp_create_target(struct device *dev,
 	if (ret) {
 		shost_printk(KERN_ERR, target->scsi_host,
 			     PFX "Connection failed\n");
-		goto err_cm_id;
+		goto err_free_ib;
 	}
 
 	ret = srp_add_target(host, target);
@@ -3067,9 +3071,6 @@  out:
 err_disconnect:
 	srp_disconnect_target(target);
 
-err_cm_id:
-	ib_destroy_cm_id(target->cm_id);
-
 err_free_ib:
 	srp_free_target_ib(target);