Patchwork [6/6,V3] sparc: Fix sbus_alloc_coherent error handling.

login
register
mail settings
Submitter Kristoffer Glembo
Date Jan. 18, 2011, 2:10 p.m.
Message ID <1295359829-27308-7-git-send-email-kristoffer@gaisler.com>
Download mbox | patch
Permalink /patch/79305/
State Accepted
Delegated to: David Miller
Headers show

Comments

Kristoffer Glembo - Jan. 18, 2011, 2:10 p.m.
Order of kfree and free_pages were swapped in the error handling.

Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
---
 arch/sparc/kernel/ioport.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Sam Ravnborg - Jan. 18, 2011, 7:43 p.m.
On Tue, Jan 18, 2011 at 03:10:29PM +0100, Kristoffer Glembo wrote:
> Order of kfree and free_pages were swapped in the error handling.
Well spotted!

Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 22, 2011, 12:52 a.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 18 Jan 2011 20:43:17 +0100

> On Tue, Jan 18, 2011 at 03:10:29PM +0100, Kristoffer Glembo wrote:
>> Order of kfree and free_pages were swapped in the error handling.
> Well spotted!
> 
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

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

Patch

diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index bd4fb10..c6ce9a6 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -302,9 +302,9 @@  static void *sbus_alloc_coherent(struct device *dev, size_t len,
 err_noiommu:
 	release_resource(res);
 err_nova:
-	free_pages(va, order);
-err_nomem:
 	kfree(res);
+err_nomem:
+	free_pages(va, order);
 err_nopages:
 	return NULL;
 }