Commit 5fb8fd0d authored by Bhanu Prakash Gollapudi's avatar Bhanu Prakash Gollapudi Committed by James Bottomley

[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: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent b338c785
...@@ -76,7 +76,7 @@ static void bnx2fc_offload_session(struct fcoe_port *port, ...@@ -76,7 +76,7 @@ static void bnx2fc_offload_session(struct fcoe_port *port,
if (rval) { if (rval) {
printk(KERN_ERR PFX "Failed to allocate conn id for " printk(KERN_ERR PFX "Failed to allocate conn id for "
"port_id (%6x)\n", rport->port_id); "port_id (%6x)\n", rport->port_id);
goto ofld_err; goto tgt_init_err;
} }
/* Allocate session resources */ /* Allocate session resources */
...@@ -141,11 +141,12 @@ static void bnx2fc_offload_session(struct fcoe_port *port, ...@@ -141,11 +141,12 @@ static void bnx2fc_offload_session(struct fcoe_port *port,
ofld_err: ofld_err:
/* couldn't offload the session. log off from this rport */ /* couldn't offload the session. log off from this rport */
BNX2FC_TGT_DBG(tgt, "bnx2fc_offload_session - offload error\n"); BNX2FC_TGT_DBG(tgt, "bnx2fc_offload_session - offload error\n");
lport->tt.rport_logoff(rdata);
/* Free session resources */ /* Free session resources */
bnx2fc_free_session_resc(hba, tgt); bnx2fc_free_session_resc(hba, tgt);
tgt_init_err:
if (tgt->fcoe_conn_id != -1) if (tgt->fcoe_conn_id != -1)
bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id); bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id);
lport->tt.rport_logoff(rdata);
} }
void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)
...@@ -790,8 +791,6 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, ...@@ -790,8 +791,6 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
return 0; return 0;
mem_alloc_failure: mem_alloc_failure:
bnx2fc_free_session_resc(hba, tgt);
bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id);
return -ENOMEM; return -ENOMEM;
} }
......
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