summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrishna Srinivas <krisrini@codeaurora.org>2016-09-22 16:18:55 -0700
committerHarsh Sahu <hsahu@codeaurora.org>2016-10-21 18:51:38 -0700
commit1577550d24360715c2566dc8cea95443d6ff82ca (patch)
tree77cb09bdd96010fac807a50a72835123e1ee1cef
parentab0495758864f78a01957ad18d7f036236f4b0d1 (diff)
msm: mdss: Fix memleak in panel_debug_reg_write
Free panel buffer or register buffer if either allocation fails. Change-Id: I600c646a0c23b654392d8e00a829bfd88b71c38c Signed-off-by: Krishna Srinivas <krisrini@codeaurora.org> Signed-off-by: Harsh Sahu <hsahu@codeaurora.org>
-rw-r--r--drivers/video/fbdev/msm/mdss_debug.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/video/fbdev/msm/mdss_debug.c b/drivers/video/fbdev/msm/mdss_debug.c
index 3436db661e87..8663797f1730 100644
--- a/drivers/video/fbdev/msm/mdss_debug.c
+++ b/drivers/video/fbdev/msm/mdss_debug.c
@@ -214,6 +214,7 @@ static ssize_t panel_debug_base_reg_read(struct file *file,
struct mdss_panel_data *panel_data = ctl->panel_data;
struct mdss_dsi_ctrl_pdata *ctrl_pdata = container_of(panel_data,
struct mdss_dsi_ctrl_pdata, panel_data);
+ int rc = -EFAULT;
if (!dbg)
return -ENODEV;
@@ -232,7 +233,8 @@ static ssize_t panel_debug_base_reg_read(struct file *file,
if (!rx_buf || !panel_reg_buf) {
pr_err("not enough memory to hold panel reg dump\n");
- return -ENOMEM;
+ rc = -ENOMEM;
+ goto read_reg_fail;
}
if (mdata->debug_inf.debug_enable_clock)
@@ -271,8 +273,7 @@ static ssize_t panel_debug_base_reg_read(struct file *file,
read_reg_fail:
kfree(rx_buf);
kfree(panel_reg_buf);
- return -EFAULT;
-
+ return rc;
}
static const struct file_operations panel_off_fops = {