All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Samuel Ortiz <sameo@linux.intel.com>,
	lm-sensors@lm-sensors.org, Jean Delvare <khali@linux-fr.org>,
	Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH RESEND] jz4740-hwmon: check kmalloc() result
Date: Mon, 02 Aug 2010 09:16:35 +0800	[thread overview]
Message-ID: <1280711795.6538.9.camel@mola> (raw)

>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




             reply	other threads:[~2010-08-02  1:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02  1:16 Axel Lin [this message]
2010-08-02  1:50 ` [PATCH RESEND] jz4740-hwmon: check kmalloc() result Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280711795.6538.9.camel@mola \
    --to=axel.lin@gmail.com \
    --cc=khali@linux-fr.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=ralf@linux-mips.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.