From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753409AbbBEW2S (ORCPT ); Thu, 5 Feb 2015 17:28:18 -0500 Received: from mout.web.de ([212.227.15.14]:63656 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbbBEW2R (ORCPT ); Thu, 5 Feb 2015 17:28:17 -0500 Message-ID: <54D3EE7C.8010005@users.sourceforge.net> Date: Thu, 05 Feb 2015 23:28:12 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: James Smart , "James E. J. Bottomley" , linux-scsi@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 2/2] SCSI-lpfc: One function call less in lpfc_bsg_hba_set_event() after error detection References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <54D3EDDB.1050905@users.sourceforge.net> In-Reply-To: <54D3EDDB.1050905@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:163kOC/7hSIAAeWUYLGA0jLyU1F6jr0KDg1QGzfVTwn4nG01DQN KolHVUmHEN3eyWz72NV/708dxcpdHbZs6YEf3NAILfb+kJcIDKJhr2tJK5uGKOp/deDFGMv HpBcLjI5hGtIsR1Xfib0lBeEEUA+cOw/AjoE0DoOdF6RBXK6F3SkeU+teDEt4Z3sHHilebH 9mtydMt3/lw+P41Zwg9ew== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring 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 --- 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