public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] jz4740-adc: check kmalloc() result
@ 2010-08-02  1:12 Axel Lin
  2010-08-02  8:49 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-08-02  1:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lars-Peter Clausen, Samuel Ortiz

>From 40f965e63c4aefb402d85cf8392681565e172d2d Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@gmail.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@gmail.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




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

end of thread, other threads:[~2010-08-02  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02  1:12 [PATCH RESEND] jz4740-adc: check kmalloc() result Axel Lin
2010-08-02  8:49 ` Samuel Ortiz

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