Skip to content

Commit

Permalink
V4L/DVB: drivers/media: Correct NULL test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Mauro Carvalho Chehab committed Feb 26, 2010
1 parent f0289ef commit 62bdbb7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
5 changes: 0 additions & 5 deletions drivers/media/dvb/frontends/stv0900_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions drivers/media/video/cpia.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 62bdbb7

Please sign in to comment.