Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: video: fbdev: atmel_lcdfb.c: fix error return code

Convert a zero return value on error to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Julia Lawall and committed by
Tomi Valkeinen
6c131850 2b6c53b1

+2
+2
drivers/video/fbdev/atmel_lcdfb.c
··· 1102 1102 timings = of_get_display_timings(display_np); 1103 1103 if (!timings) { 1104 1104 dev_err(dev, "failed to get display timings\n"); 1105 + ret = -EINVAL; 1105 1106 goto put_display_node; 1106 1107 } 1107 1108 1108 1109 timings_np = of_find_node_by_name(display_np, "display-timings"); 1109 1110 if (!timings_np) { 1110 1111 dev_err(dev, "failed to find display-timings node\n"); 1112 + ret = -ENODEV; 1111 1113 goto put_display_node; 1112 1114 } 1113 1115