Skip to contentSkip to conversation

arm/mach-u300: check kmalloc result

PATCH Applied Kulikov Vasiliy 2 participants 2 messages Jul 16, 2010 – Jul 17, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 2/15 arm/mach-u300: check kmalloc result

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

---
 arch/arm/mach-u300/dummyspichip.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-u300/dummyspichip.c +5 -0
index 5f55012..452218a 100644
@@ -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);
Signature · 1 line
1.7.0.4
#1 lore raw

2010/7/16 Kulikov Vasiliy <[email protected]>:

Quoted 2 lines

 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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html