summaryrefslogtreecommitdiff
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-12-13 12:13:51 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-12-13 12:13:51 +0200
commitfa0c5e71295fa4d62b900818d900c16980985e72 (patch)
tree2cc89b6c3d598591156a150df9e4a227db1cad42 /drivers/video/omap2
parent057eeaee6803dafbbf2f79345643530e731ba7cb (diff)
downloadlinux-3.10-fa0c5e71295fa4d62b900818d900c16980985e72.tar.gz
linux-3.10-fa0c5e71295fa4d62b900818d900c16980985e72.tar.bz2
linux-3.10-fa0c5e71295fa4d62b900818d900c16980985e72.zip
OMAPFB: fix error handling in omapfb_find_best_mode()
omapfb_find_best_mode() doesn't check for the return value of kmalloc. Fix this. This also removes the smatch warning: drivers/video/omap2/omapfb/omapfb-main.c:2256 omapfb_find_best_mode() error: potential null dereference 'specs'. (kzalloc returns null) Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 477a20817d0..948dfb9f3e9 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2241,12 +2241,18 @@ static int omapfb_find_best_mode(struct omap_dss_device *display,
len = 0x80 * 2;
edid = kmalloc(len, GFP_KERNEL);
+ if (edid == NULL)
+ return -ENOMEM;
r = display->driver->read_edid(display, edid, len);
if (r < 0)
goto err1;
specs = kzalloc(sizeof(*specs), GFP_KERNEL);
+ if (specs == NULL) {
+ r = -ENOMEM;
+ goto err1;
+ }
fb_edid_to_monspecs(edid, specs);