Skip to content

Commit

Permalink
OMAPFB: fix error handling in omapfb_find_best_mode()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tomi Valkeinen committed Dec 13, 2012
1 parent 057eeae commit fa0c5e7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/video/omap2/omapfb/omapfb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fa0c5e7

Please sign in to comment.