* [PATCH RESEND] jz4740-hwmon: check kmalloc() result
@ 2010-08-02 1:16 Axel Lin
2010-08-02 1:50 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-08-02 1:16 UTC (permalink / raw)
To: linux-kernel
Cc: Lars-Peter Clausen, Samuel Ortiz, lm-sensors, Jean Delvare,
Ralf Baechle
>From 16482398f86ac6cc3b08b10352efd01b56d67473 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@gmail.com>
Date: Mon, 2 Aug 2010 09:02:26 +0800
Subject: [PATCH] jz4740-hwmon: 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/hwmon/jz4740-hwmon.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c
index 72a4335..1c8b3d9 100644
--- a/drivers/hwmon/jz4740-hwmon.c
+++ b/drivers/hwmon/jz4740-hwmon.c
@@ -107,6 +107,10 @@ static int __devinit jz4740_hwmon_probe(struct platform_device *pdev)
struct jz4740_hwmon *hwmon;
hwmon = kmalloc(sizeof(*hwmon), GFP_KERNEL);
+ if (!hwmon) {
+ dev_err(&pdev->dev, "Failed to allocate driver structure\n");
+ return -ENOMEM;
+ }
hwmon->cell = pdev->dev.platform_data;
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH RESEND] jz4740-hwmon: check kmalloc() result
2010-08-02 1:16 [PATCH RESEND] jz4740-hwmon: check kmalloc() result Axel Lin
@ 2010-08-02 1:50 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2010-08-02 1:50 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Lars-Peter Clausen, Samuel Ortiz, lm-sensors,
Jean Delvare
On Mon, Aug 02, 2010 at 09:16:35AM +0800, Axel Lin wrote:
> From: Axel Lin <axel.lin@gmail.com>
> Date: Mon, 2 Aug 2010 09:02:26 +0800
> Subject: [PATCH] jz4740-hwmon: check kmalloc() result
>
> If kmalloc() fails exit with -ENOMEM.
Thanks, folded into the existing patch.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-02 1:52 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:16 [PATCH RESEND] jz4740-hwmon: check kmalloc() result Axel Lin
2010-08-02 1:50 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox