Commit 4e51af9e authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin K. Petersen

bfa: fix bfa_fcb_itnim_alloc() error handling

The caller assumes that "itnim" is NULL on error and non-NULL on success
but really "itnim" is uninitialized on error.  This function should just
use normal error handling where it returns zero on success and negative
on failure.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarAnil Gurumurthy <anil.gurumurthy@qlogic.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 13f30771
...@@ -874,7 +874,7 @@ bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad, ...@@ -874,7 +874,7 @@ bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad,
/* /*
* itnim callbacks * itnim callbacks
*/ */
void bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim, int bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
struct bfad_itnim_s **itnim_drv); struct bfad_itnim_s **itnim_drv);
void bfa_fcb_itnim_free(struct bfad_s *bfad, void bfa_fcb_itnim_free(struct bfad_s *bfad,
struct bfad_itnim_s *itnim_drv); struct bfad_itnim_s *itnim_drv);
......
...@@ -588,12 +588,13 @@ bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport) ...@@ -588,12 +588,13 @@ bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport)
struct bfa_fcs_lport_s *port = rport->port; struct bfa_fcs_lport_s *port = rport->port;
struct bfa_fcs_itnim_s *itnim; struct bfa_fcs_itnim_s *itnim;
struct bfad_itnim_s *itnim_drv; struct bfad_itnim_s *itnim_drv;
int ret;
/* /*
* call bfad to allocate the itnim * call bfad to allocate the itnim
*/ */
bfa_fcb_itnim_alloc(port->fcs->bfad, &itnim, &itnim_drv); ret = bfa_fcb_itnim_alloc(port->fcs->bfad, &itnim, &itnim_drv);
if (itnim == NULL) { if (ret) {
bfa_trc(port->fcs, rport->pwwn); bfa_trc(port->fcs, rport->pwwn);
return NULL; return NULL;
} }
......
...@@ -440,13 +440,13 @@ bfad_im_slave_destroy(struct scsi_device *sdev) ...@@ -440,13 +440,13 @@ bfad_im_slave_destroy(struct scsi_device *sdev)
* BFA FCS itnim alloc callback, after successful PRLI * BFA FCS itnim alloc callback, after successful PRLI
* Context: Interrupt * Context: Interrupt
*/ */
void int
bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim, bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
struct bfad_itnim_s **itnim_drv) struct bfad_itnim_s **itnim_drv)
{ {
*itnim_drv = kzalloc(sizeof(struct bfad_itnim_s), GFP_ATOMIC); *itnim_drv = kzalloc(sizeof(struct bfad_itnim_s), GFP_ATOMIC);
if (*itnim_drv == NULL) if (*itnim_drv == NULL)
return; return -ENOMEM;
(*itnim_drv)->im = bfad->im; (*itnim_drv)->im = bfad->im;
*itnim = &(*itnim_drv)->fcs_itnim; *itnim = &(*itnim_drv)->fcs_itnim;
...@@ -457,6 +457,7 @@ bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim, ...@@ -457,6 +457,7 @@ bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
*/ */
INIT_WORK(&(*itnim_drv)->itnim_work, bfad_im_itnim_work_handler); INIT_WORK(&(*itnim_drv)->itnim_work, bfad_im_itnim_work_handler);
bfad->bfad_flags |= BFAD_RPORT_ONLINE; bfad->bfad_flags |= BFAD_RPORT_ONLINE;
return 0;
} }
/* /*
......
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