[PATCH 2/2] SCSI-lpfc: One function call less in lpfc_bsg_hba_set_event() after error detection

SF Markus Elfring
2015-02-05T22:28:18Z

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Feb 2015 23:03:52 +0100

The kfree() function was called in two cases by the lpfc_bsg_hba_set_event()
function during error handling even if the passed variable "dd_data" contained
still a null pointer.

This implementation detail could be improved by the introduction of another
jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/scsi/lpfc/lpfc_bsg.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 1af783a..b8074cf 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -1240,7 +1240,7 @@ lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
"2617 Failed allocation of event "
"waiter\n");
rc = -ENOMEM;
- goto job_error;
+ goto free_data;
}
dd_data->type = TYPE_EVT;
dd_data->set_job = NULL;
@@ -1260,8 +1260,9 @@ lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
return 0; /* call job done later */

-job_error:
+free_data:
kfree(dd_data);
+job_error:
job->dd_data = NULL;
return rc;
}
--
2.2.2