diff options
| author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-12-13 05:13:51 -0500 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-12-13 05:13:51 -0500 |
| commit | fa0c5e71295fa4d62b900818d900c16980985e72 (patch) | |
| tree | 2cc89b6c3d598591156a150df9e4a227db1cad42 /drivers/video/omap2 | |
| parent | 057eeaee6803dafbbf2f79345643530e731ba7cb (diff) | |
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.c | 6 |
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, | |||
| 2241 | 2241 | ||
| 2242 | len = 0x80 * 2; | 2242 | len = 0x80 * 2; |
| 2243 | edid = kmalloc(len, GFP_KERNEL); | 2243 | edid = kmalloc(len, GFP_KERNEL); |
| 2244 | if (edid == NULL) | ||
| 2245 | return -ENOMEM; | ||
| 2244 | 2246 | ||
| 2245 | r = display->driver->read_edid(display, edid, len); | 2247 | r = display->driver->read_edid(display, edid, len); |
| 2246 | if (r < 0) | 2248 | if (r < 0) |
| 2247 | goto err1; | 2249 | goto err1; |
| 2248 | 2250 | ||
| 2249 | specs = kzalloc(sizeof(*specs), GFP_KERNEL); | 2251 | specs = kzalloc(sizeof(*specs), GFP_KERNEL); |
| 2252 | if (specs == NULL) { | ||
| 2253 | r = -ENOMEM; | ||
| 2254 | goto err1; | ||
| 2255 | } | ||
| 2250 | 2256 | ||
| 2251 | fb_edid_to_monspecs(edid, specs); | 2257 | fb_edid_to_monspecs(edid, specs); |
| 2252 | 2258 | ||
