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-11-18 11:46:02 +0900
commitb1489e3f5896b02032cea8428ae6556b5489cc93 (patch)
tree4c6b52282fa989dd0ac09d3abd85b18bd0bfa8bc /drivers/video
parent893ba43feefe15769fd1988b33691f0e0ac00b28 (diff)
downloadlinux-3.10-b1489e3f5896b02032cea8428ae6556b5489cc93.tar.gz
linux-3.10-b1489e3f5896b02032cea8428ae6556b5489cc93.tar.bz2
linux-3.10-b1489e3f5896b02032cea8428ae6556b5489cc93.zip
video: display: panel-s6d6aa1: Use devm_kzalloc to allocate driver data
This fixes memory leak on probe error path. Change-Id: Iafc7a9920869e59d792c480770dcb07507a998da 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-s6d6aa1.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/video/display/panel-s6d6aa1.c b/drivers/video/display/panel-s6d6aa1.c
index 9d0e7c81f58..b3bdf7c7e52 100644
--- a/drivers/video/display/panel-s6d6aa1.c
+++ b/drivers/video/display/panel-s6d6aa1.c
@@ -691,7 +691,6 @@ static void s6d6aa1_release(struct display_entity *entity)
backlight_device_unregister(panel->bd);
regulator_bulk_free(ARRAY_SIZE(panel->supplies), panel->supplies);
- kfree(panel);
}
static int s6d6aa1_probe(struct platform_device *pdev)
@@ -699,7 +698,7 @@ static int s6d6aa1_probe(struct platform_device *pdev)
struct s6d6aa1 *lcd;
int ret;
- lcd = kzalloc(sizeof(struct s6d6aa1), GFP_KERNEL);
+ lcd = devm_kzalloc(&pdev->dev, sizeof(struct s6d6aa1), GFP_KERNEL);
if (!lcd) {
dev_err(&pdev->dev, "failed to allocate s6d6aa1 structure.\n");
return -ENOMEM;
@@ -722,7 +721,7 @@ static int s6d6aa1_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("s6d6aa1", &pdev->dev, lcd,
@@ -769,8 +768,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;
}