diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-02-12 13:02:07 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-11 16:56:39 +0400 |
commit | 341ef565f8287695709266e7533995ffcdcc7a38 (patch) | |
tree | 5bc686e3c1b9e5036bce3432801b789e6a16dd96 /drivers | |
parent | d1166b0f178d8dce66714288e25af1d4d6c6f2d3 (diff) | |
download | linux-341ef565f8287695709266e7533995ffcdcc7a38.tar.xz |
[media] lm3560: prevent memory leak in case of pdata absence
If we have no pdata defined and driver fails to register we leak memory.
Converting to devm_kzalloc prevents this to happen.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/i2c/lm3560.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index 93e52270c9cc..c23de593c17d 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c @@ -416,8 +416,7 @@ static int lm3560_probe(struct i2c_client *client, /* if there is no platform data, use chip default value */ if (pdata == NULL) { - pdata = - kzalloc(sizeof(struct lm3560_platform_data), GFP_KERNEL); + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); if (pdata == NULL) return -ENODEV; pdata->peak = LM3560_PEAK_3600mA; |