mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 02/15] arm/mach-u300: check kmalloc result
@ 2010-07-16 16:12 Kulikov Vasiliy
  2010-07-17 10:00 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Kulikov Vasiliy @ 2010-07-16 16:12 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Linus Walleij, Russell King, Tejun Heo, linux-arm-kernel, linux-kernel

If kmalloc() fails free already allocated memory and exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 arch/arm/mach-u300/dummyspichip.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 5f55012..452218a 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -64,6 +64,11 @@ static ssize_t dummy_looptest(struct device *dev,
 		goto out;
 	}
 	bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
+	if (bigrxbuf_virtual == NULL) {
+		kfree(bigtxbuf_virtual);
+		status = -ENOMEM;
+		goto out;
+	}
 
 	/* Fill TXBUF with some happy pattern */
 	memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 02/15] arm/mach-u300: check kmalloc result
  2010-07-16 16:12 [PATCH 02/15] arm/mach-u300: check kmalloc result Kulikov Vasiliy
@ 2010-07-17 10:00 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2010-07-17 10:00 UTC (permalink / raw)
  To: Kulikov Vasiliy
  Cc: kernel-janitors, Russell King, Tejun Heo, linux-arm-kernel,
	linux-kernel, spi mailing list

2010/7/16 Kulikov Vasiliy <segooon@gmail.com>:

>  arch/arm/mach-u300/dummyspichip.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)

NACK I have recently submitted two patches to move this test chip to
drivers/spi, please base your fixes work on top of those patches
instead, and make sure to mail them to Grant Likely and the
spi-devel-general list.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-17 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-16 16:12 [PATCH 02/15] arm/mach-u300: check kmalloc result Kulikov Vasiliy
2010-07-17 10:00 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome