Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbbF1QY2 (ORCPT ); Sun, 28 Jun 2015 12:24:28 -0400 Received: from mout.web.de ([212.227.15.3]:60641 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752608AbbF1QYT (ORCPT ); Sun, 28 Jun 2015 12:24:19 -0400 Message-ID: <55901FAC.1090109@users.sourceforge.net> Date: Sun, 28 Jun 2015 18:24:12 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Alex Williamson , kvm@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Alexey Kardashevskiy , Julia Lawall , Michael Ellerman Subject: [PATCH 2/2] vfio: powerpc/spapr: One function call less in tce_iommu_attach_group() after kzalloc() failure 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> <55901E68.80205@users.sourceforge.net> In-Reply-To: <55901E68.80205@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:SFvdBupKiR0ziNJEVZu9knChawLBUvNZ1HSuR0Prkf4+8PNytbW Kk5dDCXokFpINQnYMr9kgyPhanPt2jjllz6YxbEeQdy8X6dhuRqEDRc8S7kRbjEMl+zHjta IJVj8EOM/qIHOj149yCDBzMLuim+FwbzSmk9L5mHI/j5mbYfuKUFXU8k56TdX4+tReI+adz Xzar5/WHpVrky0IVevC8A== X-UI-Out-Filterresults: notjunk:1;V01:K0:c0rE4J4ZdCQ=:R9kYAYVl6Mv3gFV3G1krj8 52hHkiRSezWUE/qhDARBt4KA+2IjX1K1WDaYDDOQi0IK1KgbCdfJc10V/Yzd6QUa8vdHNRyq4 gTswj7kg46b/oUKwSw1qlVX4wjA0Oaj7xFmKj1/FRYBryKwZX9gmbkFtGVBLWVw11160Zwi1y cNb7FQITxUHtyzAGuWEE0cWLNhpdB3yhsudCejWuwENfo9o4alQQTx/jOcSAbHKAiV1zFeYgY 12OOp8JqWABI407KPHMDbZyo4BvgqVmUAvK03TT1777ntfc0b7IZiHtNWq8Ly4NPHO94l/JUt 8OhieW9IZci2yMazN3iIxBTE1j2BsxmW4LVOeoVTxUeV/G0IEkai8nMoAvK9+iyfWNviqDKWy 2w2+GDaNxGECJDGmLLYY3DDR4STO1qCLSvrnINke8pkypMuT6dGRxPiSR3wEocxI0Eb9FRntX RzeCtC8uSFfynEJhwMxrUD9tb1g3OMxpPyLF8gKgHufR3EsYUn0MtM0z1dBVtDPuPiTKzmlC2 y54DlLJ8IGLXQfU3/ltphpTjLb8lFnKVL6F5bNZTdHZF9OIUwJ03lDvQstijR22fg42YDexaR KkbkXGaqk6RjHbjpd8vzm8YFVW1FeUGz4CVwUzynNlTjMiR5lFAsDfNJbDpNGhdtI+l5I1mUb mFX3VxbFROkpPqsz6rkTx1472+NEed2/0L328iS6nNXy2CBQoIpKbX5j1fjUBUaB6mKc= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1345 Lines: 44 From: Markus Elfring Date: Sun, 28 Jun 2015 17:58:42 +0200 The kfree() function was called even if a previous memory allocation try failed. This implementation detail could be improved by the introduction of another jump label. Signed-off-by: Markus Elfring --- drivers/vfio/vfio_iommu_spapr_tce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 50ddfac..2523075 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -1200,7 +1200,7 @@ static int tce_iommu_attach_group(void *iommu_data, tcegrp = kzalloc(sizeof(*tcegrp), GFP_KERNEL); if (!tcegrp) { ret = -ENOMEM; - goto unlock_exit; + goto unlock_container; } if (!table_group->ops || !table_group->ops->take_ownership || @@ -1217,7 +1217,7 @@ static int tce_iommu_attach_group(void *iommu_data, unlock_exit: if (ret) kfree(tcegrp); - +unlock_container: mutex_unlock(&container->lock); return ret; -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/