]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
V4L/DVB: drivers/media: Correct NULL test
authorJulia Lawall <julia@diku.dk>
Sat, 6 Feb 2010 08:43:58 +0000 (05:43 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:57 +0000 (15:10 -0300)
In each case, the NULL test has been performed already.

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

// <smpl>
@r@
expression *x;
expression e;
identifier l;
@@

if (x == NULL || ...) {
    ... when forall
    return ...; }
... when != goto l;
    when != x = e
    when != &x
*x == NULL
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stv0900_core.c
drivers/media/video/cpia.c

index e5791b2b913b0674592aec1502816c1cb6683d1d..01f8f1f802fdadefc5e50ac8603e1ff97f3c9eac 100644 (file)
@@ -1417,11 +1417,6 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
                return error;
        }
 
-       if (state->internal == NULL) {
-               error = STV0900_INVALID_HANDLE;
-               return error;
-       }
-
        intp = state->internal;
 
        intp->demod_mode = p_init->demod_mode;
index 551ddf216a4bb21d51b9c6425a992946594d0e0f..933ae4c8cb9a6467b63f2d576e2b008b86c95ae8 100644 (file)
@@ -3737,9 +3737,6 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
        if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE)
                return -EINVAL;
 
-       if (!cam || !cam->ops)
-               return -ENODEV;
-
        /* make this _really_ smp-safe */
        if (mutex_lock_interruptible(&cam->busy_lock))
                return -EINTR;