summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-11-04 16:38:47 +0100
committerChanho Park <chanho61.park@samsung.com>2014-03-20 17:42:19 +0900
commit5ded3a5074ac03bb5f292a8c826c7bcf80fe8a72 (patch)
tree2d0360b8687ce7b7772712c6bca0dcd5749cf70f /drivers/video
parentbcc7c4f54aaa97304580884f866884f359e75b32 (diff)
downloadlinux-3.10-5ded3a5074ac03bb5f292a8c826c7bcf80fe8a72.tar.gz
linux-3.10-5ded3a5074ac03bb5f292a8c826c7bcf80fe8a72.tar.bz2
linux-3.10-5ded3a5074ac03bb5f292a8c826c7bcf80fe8a72.zip
video: display: panel-s6e8aa0: Use devm_kzalloc to allocate driver data
This fixes memory leak on probe error path. Change-Id: Ibea51282dee8139a85764f39e7c894a94036f0cf Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/display/panel-s6e8aa0.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/video/display/panel-s6e8aa0.c b/drivers/video/display/panel-s6e8aa0.c
index 66c08f6f64f..1bfa30f0511 100644
--- a/drivers/video/display/panel-s6e8aa0.c
+++ b/drivers/video/display/panel-s6e8aa0.c
@@ -1291,7 +1291,6 @@ static void s6e8aa0_release(struct display_entity *entity)
struct s6e8aa0 *panel = to_panel(entity);
regulator_bulk_free(ARRAY_SIZE(panel->supplies), panel->supplies);
- kfree(panel);
}
static int s6e8aa0_probe(struct platform_device *pdev)
@@ -1299,7 +1298,7 @@ static int s6e8aa0_probe(struct platform_device *pdev)
struct s6e8aa0 *lcd;
int ret;
- lcd = kzalloc(sizeof(struct s6e8aa0), GFP_KERNEL);
+ lcd = devm_kzalloc(&pdev->dev, sizeof(struct s6e8aa0), GFP_KERNEL);
if (!lcd) {
dev_err(&pdev->dev, "failed to allocate s6e8aa0 structure.\n");
return -ENOMEM;
@@ -1322,7 +1321,7 @@ static int s6e8aa0_probe(struct platform_device *pdev)
ARRAY_SIZE(lcd->supplies), lcd->supplies);
if (ret) {
dev_err(&pdev->dev, "Failed to get regulators: %d\n", ret);
- goto err_regulator_bulk_get;
+ return ret;
}
lcd->ld = lcd_device_register("s6e8aa0", &pdev->dev, lcd,
@@ -1370,8 +1369,6 @@ err_backlight_register:
lcd_device_unregister(lcd->ld);
err_lcd_register:
regulator_bulk_free(ARRAY_SIZE(lcd->supplies), lcd->supplies);
-err_regulator_bulk_get:
- kfree(lcd);
return ret;
}