summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-12-15 16:46:26 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 07:20:01 -0800
commitd2a34c13e7ccec5d06eafd60e6f80ea531b34668 (patch)
tree535f0ba7f4b95d53d3d871bc6a49d2fecf22b052 /drivers/video
parent2f390380ca69e1617cdddb12d8da94f0a9f4319d (diff)
downloadop-kernel-dev-d2a34c13e7ccec5d06eafd60e6f80ea531b34668.zip
op-kernel-dev-d2a34c13e7ccec5d06eafd60e6f80ea531b34668.tar.gz
drivers/video: Move dereference after NULL test
If the NULL test on fbi is needed, then the dereference should be after the NULL test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // <smpl> @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Daniel Mack <daniel@caiaq.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/pxafb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index b7e5805..415858b 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1221,13 +1221,14 @@ static void setup_smart_timing(struct pxafb_info *fbi,
static int pxafb_smart_thread(void *arg)
{
struct pxafb_info *fbi = arg;
- struct pxafb_mach_info *inf = fbi->dev->platform_data;
+ struct pxafb_mach_info *inf;
- if (!fbi || !inf->smart_update) {
+ if (!fbi || !fbi->dev->platform_data->smart_update) {
pr_err("%s: not properly initialized, thread terminated\n",
__func__);
return -EINVAL;
}
+ inf = fbi->dev->platform_data;
pr_debug("%s(): task starting\n", __func__);
OpenPOWER on IntegriCloud