From: Satish <x0124...@ti.com>

The memory allocated for sgt structure is not freed on error
when sg_alloc_table is called in sg_alloc_table().

Signed-off-by: Satish Kumar <x0124...@ti.com>
Signed-off-by: Manjunatha GK <manj...@ti.com>
Cc: Tony Lindgren <t...@atomide.com>
---
 arch/arm/plat-omap/iovmm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index e43983b..8ce0de2 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -140,8 +140,10 @@ static struct sg_table *sgtable_alloc(const size_t bytes, 
u32 flags)
                return ERR_PTR(-ENOMEM);
 
        err = sg_alloc_table(sgt, nr_entries, GFP_KERNEL);
-       if (err)
+       if (err) {
+               kfree(sgt);
                return ERR_PTR(err);
+       }
 
        pr_debug("%s: sgt:%p(%d entries)\n", __func__, sgt, nr_entries);
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to