diff options
author | Julien Brunel <brunel@diku.dk> | 2008-11-19 18:36:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-19 21:49:57 -0500 |
commit | cf7b9a1e11993a064f445d332fecf22819b87a5e (patch) | |
tree | c9642ffcd59e666a882635e7cfb2b8dcb48b7fc1 /drivers/video/atmel_lcdfb.c | |
parent | 9ca791bbd464d7968db1530b433cc397a4c348c1 (diff) |
drivers/video: bad error test before a dereference
The error test that follows the call to backlight_device_register semms
not to concern the right variable.
A simplified version of the semantic match that finds this problem is
as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@def0@
expression x;
position p0;
@@
x@p0 = backlight_device_register(...)
@protected@
expression def0.x,E;
position def0.p0;
position p;
statement S;
@@
x@p0
... when != x = E
if (!IS_ERR(x) && ...) {<... x@p ...>} else S
@unprotected@
expression def0.x;
identifier fld;
position def0.p0;
position p != protected.p;
@@
x@p0
... when != x = E
* x@p->fld
// </smpl>
Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/atmel_lcdfb.c')
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index f8d0a57a07cb..9a577a800db5 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -132,7 +132,7 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) | |||
132 | 132 | ||
133 | bl = backlight_device_register("backlight", &sinfo->pdev->dev, | 133 | bl = backlight_device_register("backlight", &sinfo->pdev->dev, |
134 | sinfo, &atmel_lcdc_bl_ops); | 134 | sinfo, &atmel_lcdc_bl_ops); |
135 | if (IS_ERR(sinfo->backlight)) { | 135 | if (IS_ERR(bl)) { |
136 | dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n", | 136 | dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n", |
137 | PTR_ERR(bl)); | 137 | PTR_ERR(bl)); |
138 | return; | 138 | return; |