Re: [PATCH 1/1] leds: Add LED driver for lm3556 chip
From: Andrew Morton
Date: Fri Mar 30 2012 - 14:26:58 EST
On Fri, 30 Mar 2012 15:38:28 +0900
Geon Si Jeong <gshark.jeong@xxxxxxxxx> 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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/