diff options
author | Bhanu Prakash Gollapudi <bprakash@broadcom.com> | 2011-08-04 20:38:47 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 10:35:44 -0400 |
commit | 5fb8fd0dbc0f7e3bc3ea594223e5d4b50c2092d9 (patch) | |
tree | 2a5d289bcdf75d799539dc24a6377469e9bf9cc4 /drivers/scsi/bnx2fc | |
parent | b338c785c5c945383046ff39092e3021ea5b1d95 (diff) |
[SCSI] bnx2fc: code cleanup in bnx2fc_offload_session
- Free session resources before rport logoff
- Do not free session resources in bnx2fc_alloc_session_resc() as it is handled
in caller's error handling path.
- Do not call bnx2fc_free_session_resc() if bnx2fc_init_tgt() fails as cq_lock
is not yet initialized.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bnx2fc')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_tgt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c index 2f7a7da5b27b..2138da9571ac 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c | |||
@@ -76,7 +76,7 @@ static void bnx2fc_offload_session(struct fcoe_port *port, | |||
76 | if (rval) { | 76 | if (rval) { |
77 | printk(KERN_ERR PFX "Failed to allocate conn id for " | 77 | printk(KERN_ERR PFX "Failed to allocate conn id for " |
78 | "port_id (%6x)\n", rport->port_id); | 78 | "port_id (%6x)\n", rport->port_id); |
79 | goto ofld_err; | 79 | goto tgt_init_err; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* Allocate session resources */ | 82 | /* Allocate session resources */ |
@@ -141,11 +141,12 @@ retry_ofld: | |||
141 | ofld_err: | 141 | ofld_err: |
142 | /* couldn't offload the session. log off from this rport */ | 142 | /* couldn't offload the session. log off from this rport */ |
143 | BNX2FC_TGT_DBG(tgt, "bnx2fc_offload_session - offload error\n"); | 143 | BNX2FC_TGT_DBG(tgt, "bnx2fc_offload_session - offload error\n"); |
144 | lport->tt.rport_logoff(rdata); | ||
145 | /* Free session resources */ | 144 | /* Free session resources */ |
146 | bnx2fc_free_session_resc(hba, tgt); | 145 | bnx2fc_free_session_resc(hba, tgt); |
146 | tgt_init_err: | ||
147 | if (tgt->fcoe_conn_id != -1) | 147 | if (tgt->fcoe_conn_id != -1) |
148 | bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id); | 148 | bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id); |
149 | lport->tt.rport_logoff(rdata); | ||
149 | } | 150 | } |
150 | 151 | ||
151 | void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) | 152 | void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) |
@@ -790,8 +791,6 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, | |||
790 | return 0; | 791 | return 0; |
791 | 792 | ||
792 | mem_alloc_failure: | 793 | mem_alloc_failure: |
793 | bnx2fc_free_session_resc(hba, tgt); | ||
794 | bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id); | ||
795 | return -ENOMEM; | 794 | return -ENOMEM; |
796 | } | 795 | } |
797 | 796 | ||