[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55901FAC.1090109@users.sourceforge.net>
Date: Sun, 28 Jun 2015 18:24:12 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Alex Williamson <alex.williamson@...hat.com>, kvm@...r.kernel.org
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Alexey Kardashevskiy <aik@...abs.ru>,
Julia Lawall <julia.lawall@...6.fr>,
Michael Ellerman <mpe@...erman.id.au>
Subject: [PATCH 2/2] vfio: powerpc/spapr: One function call less in tce_iommu_attach_group()
after kzalloc() failure
From: Markus Elfring <elfring@...rs.sourceforge.net>
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 <elfring@...rs.sourceforge.net>
---
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@...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