linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Geon Si Jeong <gshark.jeong@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Daniel Jeong <daniel.jeong@ti.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] leds: Add LED driver for lm3556 chip
Date: Fri, 30 Mar 2012 11:26:50 -0700	[thread overview]
Message-ID: <20120330112650.2a36d833.akpm@linux-foundation.org> (raw)
In-Reply-To: <1333089508-8501-2-git-send-email-gshark.jeong@gmail.com>

On Fri, 30 Mar 2012 15:38:28 +0900
Geon Si Jeong <gshark.jeong@gmail.com> wrote:

> It is a simple driver for LM3556 Chip(Texas Instruments)
> LM3556 :
> The LM3556 is a 4 MHz fixed-frequency synchronous boost
> converter plus 1.5A constant current driver for a high-current white LED.
> Datasheet: www.national.com/ds/LM/LM3556.pdf
> 
> Tested on OMAP4430
> 
> ...
>
> +EXPORT_SYMBOL_GPL(lm3556_read_reg);
> +EXPORT_SYMBOL_GPL(lm3556_write_reg);
> +EXPORT_SYMBOL_GPL(lm3556_write_bits);

These symbols are global and exported to modules, but have no
references outside this file.  Why?

> +static int lm3556_probe(struct i2c_client *client,
> +			const struct i2c_device_id *id)
> +{
> +	struct lm3556_platform_data *pdata = client->dev.platform_data;
> +	struct lm3556_chip_data *chip;
> +
> +	int err = -ENODEV;
> +
> +	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> +		printk(KERN_ERR"[LM3556]i2c functionality check fail.\n");
> +		return err;
> +	}
> +
> +	if (pdata == NULL) {
> +		printk(KERN_ERR"[LM3556] Needs Platform Data.\n");
> +		return err;
> +	}
> +
> +	chip = kzalloc(sizeof(struct lm3556_chip_data), GFP_KERNEL);
> +	chip->client = client;
> +	chip->pdata = pdata;

tsk.

--- a/drivers/leds/leds-lm3556.c~leds-add-led-driver-for-lm3556-chip-fix
+++ a/drivers/leds/leds-lm3556.c
@@ -346,7 +346,6 @@ static int lm3556_probe(struct i2c_clien
 {
 	struct lm3556_platform_data *pdata = client->dev.platform_data;
 	struct lm3556_chip_data *chip;
-
 	int err = -ENODEV;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -360,6 +359,8 @@ static int lm3556_probe(struct i2c_clien
 	}
 
 	chip = kzalloc(sizeof(struct lm3556_chip_data), GFP_KERNEL);
+	if (!chip)
+		return -ENOMEM;
 	chip->client = client;
 	chip->pdata = pdata;
 


  reply	other threads:[~2012-03-30 18:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30  6:38 [PATCH 0/1] leds: Add LED driver for lm3556 chip Geon Si Jeong
2012-03-30  6:38 ` [PATCH 1/1] " Geon Si Jeong
2012-03-30 18:26   ` Andrew Morton [this message]
2012-03-30 18:41   ` Andrew Morton
2012-04-01  3:37     ` Shuah Khan
2012-04-06 23:28       ` Andrew Morton
2012-03-30 18:56   ` Wolfram Sang
2012-03-31 21:09     ` Mark Brown
2012-04-03 22:09   ` Greg KH

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=20120330112650.2a36d833.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=daniel.jeong@ti.com \
    --cc=gshark.jeong@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).