[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1280711524.6538.3.camel@mola>
Date: Mon, 02 Aug 2010 09:12:04 +0800
From: Axel Lin <axel.lin@...il.com>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Samuel Ortiz <sameo@...ux.intel.com>
Subject: [PATCH RESEND] jz4740-adc: check kmalloc() result
>>From 40f965e63c4aefb402d85cf8392681565e172d2d Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@...il.com>
Date: Mon, 2 Aug 2010 09:02:02 +0800
Subject: [PATCH] jz4740-adc: check kmalloc() result
If kmalloc() fails exit with -ENOMEM.
Signed-off-by: Axel Lin <axel.lin@...il.com>
---
This patch is against linux-next.
This resend separates the fix for jz4740-hwmon and jz474-adc in 2 patches.
drivers/mfd/jz4740-adc.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c
index 7a844ae..2846d24 100644
--- a/drivers/mfd/jz4740-adc.c
+++ b/drivers/mfd/jz4740-adc.c
@@ -260,6 +260,10 @@ static int __devinit jz4740_adc_probe(struct platform_device *pdev)
int irq;
adc = kmalloc(sizeof(*adc), GFP_KERNEL);
+ if (!adc) {
+ dev_err(&pdev->dev, "Failed to allocate driver structure\n");
+ return -ENOMEM;
+ }
adc->irq = platform_get_irq(pdev, 0);
if (adc->irq < 0) {
--
1.5.4.3
--
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