diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-11-13 00:09:00 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 04:09:15 +0100 |
commit | e19493c1f29a3ac48db8797a79532b62a03442b8 (patch) | |
tree | 4d323aa9c38d34911484864a9cc11be18f340580 /drivers | |
parent | drivers/video/backlight/lm3630a_bl.c: fix signedness bug in lm3630a_chip_init() (diff) | |
download | linux-e19493c1f29a3ac48db8797a79532b62a03442b8.tar.xz linux-e19493c1f29a3ac48db8797a79532b62a03442b8.zip |
drivers/video/backlight/lm3630a_bl.c: potential NULL deref in probe()
We dereference "pdata" later in the function so we can't leave it as NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/backlight/lm3630a_bl.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 200dca04383f..d719a89a4381 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -389,22 +389,21 @@ static int lm3630a_probe(struct i2c_client *client, i2c_set_clientdata(client, pchip); if (pdata == NULL) { - pchip->pdata = devm_kzalloc(pchip->dev, - sizeof(struct - lm3630a_platform_data), - GFP_KERNEL); - if (pchip->pdata == NULL) + pdata = devm_kzalloc(pchip->dev, + sizeof(struct lm3630a_platform_data), + GFP_KERNEL); + if (pdata == NULL) return -ENOMEM; /* default values */ - pchip->pdata->leda_ctrl = LM3630A_LEDA_ENABLE; - pchip->pdata->ledb_ctrl = LM3630A_LEDB_ENABLE; - pchip->pdata->leda_max_brt = LM3630A_MAX_BRIGHTNESS; - pchip->pdata->ledb_max_brt = LM3630A_MAX_BRIGHTNESS; - pchip->pdata->leda_init_brt = LM3630A_MAX_BRIGHTNESS; - pchip->pdata->ledb_init_brt = LM3630A_MAX_BRIGHTNESS; - } else { - pchip->pdata = pdata; + pdata->leda_ctrl = LM3630A_LEDA_ENABLE; + pdata->ledb_ctrl = LM3630A_LEDB_ENABLE; + pdata->leda_max_brt = LM3630A_MAX_BRIGHTNESS; + pdata->ledb_max_brt = LM3630A_MAX_BRIGHTNESS; + pdata->leda_init_brt = LM3630A_MAX_BRIGHTNESS; + pdata->ledb_init_brt = LM3630A_MAX_BRIGHTNESS; } + pchip->pdata = pdata; + /* chip initialize */ rval = lm3630a_chip_init(pchip); if (rval < 0) { |