summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJong Kim <jongk@nvidia.com>2013-07-11 15:43:30 -0700
committerMatthew Pedro <mapedro@nvidia.com>2013-07-15 10:18:15 -0700
commit9c264e0f36e827f1c5a3afc2418edde226422181 (patch)
tree7dc4ef87ff6878a9b7376fff15bd43a0e9f2a093
parentd14896fd14270087550851aeb850336cfc076139 (diff)
video: tegra: dc: hdmi: remove dangling pointer
Remove dangling pointer by removing kfree in tegra_dc_add_modes. specs.modedb is allocated by tegra_dc_add_modes(), but is consumed by tegra_fb_update_monspecs(), so releasing specs.modedb creates a dangling pointer and make the system crashed, especially when the system suspends to lp0. bug 1264520 Change-Id: Ic944e75b631800ed552b7e56b5799a3e60b48afe Signed-off-by: Jong Kim <jongk@nvidia.com> Reviewed-on: http://git-master/r/248089 (cherry picked from commit e00bcba1c2d54f91d9ff93c5f8fd61c40a9ab5bd) Reviewed-on: http://git-master/r/248727 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Matthew Pedro <mapedro@nvidia.com> Tested-by: Matthew Pedro <mapedro@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/dc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 7612e4d266bf..a336e7509a20 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -2250,11 +2250,14 @@ static void tegra_dc_add_modes(struct tegra_dc *dc)
specs.modedb_len = dc->out->n_modes;
specs.modedb = kzalloc(specs.modedb_len *
sizeof(struct fb_videomode), GFP_KERNEL);
+ if (specs.modedb == NULL) {
+ dev_err(&dc->ndev->dev, "modedb allocation failed\n");
+ return;
+ }
for (i = 0; i < dc->out->n_modes; i++)
tegra_dc_to_fb_videomode(&specs.modedb[i],
&dc->out->modes[i]);
tegra_fb_update_monspecs(dc->fb, &specs, NULL);
- kfree(specs.modedb);
}
static int tegra_dc_probe(struct platform_device *ndev)