Skip to content

Commit

Permalink
[SCSI] bfa: Fix to set correct return error codes and misc cleanup.
Browse files Browse the repository at this point in the history
- Remove unnecessary if NULL check in function bfa_fcs_vport_free().
- Set correct return error codes in case of memory allocation failure
  in the BSG ELS/CT passthru command handler.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Krishna Gudipati authored and James Bottomley committed Jul 20, 2012
1 parent 85d22bb commit 529f9a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions drivers/scsi/bfa/bfa_fcs_lport.c
Original file line number Diff line number Diff line change
Expand Up @@ -5722,9 +5722,7 @@ bfa_fcs_vport_free(struct bfa_fcs_vport_s *vport)
* The memory for the bfad_vport_s is freed from the FC function
* template vport_delete entry point.
*/
if (vport_drv)
bfad_im_port_delete(vport_drv->drv_port.bfad,
&vport_drv->drv_port);
bfad_im_port_delete(vport_drv->drv_port.bfad, &vport_drv->drv_port);
}

/*
Expand Down
5 changes: 4 additions & 1 deletion drivers/scsi/bfa/bfad_bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3008,12 +3008,15 @@ bfad_im_bsg_els_ct_request(struct fc_bsg_job *job)
* buffer of size bsg_data->payload_len
*/
bsg_fcpt = kzalloc(bsg_data->payload_len, GFP_KERNEL);
if (!bsg_fcpt)
if (!bsg_fcpt) {
rc = -ENOMEM;
goto out;
}

if (copy_from_user((uint8_t *)bsg_fcpt, bsg_data->payload,
bsg_data->payload_len)) {
kfree(bsg_fcpt);
rc = -EIO;
goto out;
}

Expand Down

0 comments on commit 529f9a7

Please sign in to comment.