[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54D3EE7C.8010005@users.sourceforge.net>
Date: Thu, 05 Feb 2015 23:28:12 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: James Smart <james.smart@...lex.com>,
"James E. J. Bottomley" <JBottomley@...allels.com>,
linux-scsi@...r.kernel.org
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 2/2] SCSI-lpfc: One function call less in lpfc_bsg_hba_set_event()
after error detection
From: Markus Elfring <elfring@...rs.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@...rs.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists