]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] drivers/media/usb/{s2255drv.c, tm6000/tm6000-alsa.c, tm6000/tm6000-input...
authorJulia Lawall <Julia.Lawall@lip6.fr>
Tue, 14 Aug 2012 14:49:46 +0000 (11:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 15 Aug 2012 22:02:27 +0000 (19:02 -0300)
If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.

The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/s2255/s2255drv.c
drivers/media/usb/tm6000/tm6000-alsa.c
drivers/media/usb/tm6000/tm6000-input.c

index 6c7960cc75064f7055ee4d3a2c230504041cef56..a25513d484f705464c6f5e83152dc385d8796ebd 100644 (file)
@@ -1861,11 +1861,12 @@ static int s2255_release(struct file *file)
 static int s2255_mmap_v4l(struct file *file, struct vm_area_struct *vma)
 {
        struct s2255_fh *fh = file->private_data;
-       struct s2255_dev *dev = fh->dev;
+       struct s2255_dev *dev;
        int ret;
 
        if (!fh)
                return -ENODEV;
+       dev = fh->dev;
        dprintk(4, "%s, vma=0x%08lx\n", __func__, (unsigned long)vma);
        if (mutex_lock_interruptible(&dev->lock))
                return -ERESTARTSYS;
index bd07ec707956d377eae03f3278fa8972e8cf4972..813c1ec5360884274f5d3e31e66f9d38d91d0753 100644 (file)
@@ -487,10 +487,11 @@ error:
 
 static int tm6000_audio_fini(struct tm6000_core *dev)
 {
-       struct snd_tm6000_card  *chip = dev->adev;
+       struct snd_tm6000_card *chip;
 
        if (!dev)
                return 0;
+       chip = dev->adev;
 
        if (!chip)
                return 0;
index e80b7e190471293082b3470c6be8156a73d108f8..dffbd4bd47b15d92ffff672189aa2f18e90be4f0 100644 (file)
@@ -319,12 +319,13 @@ static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
 static int __tm6000_ir_int_start(struct rc_dev *rc)
 {
        struct tm6000_IR *ir = rc->priv;
-       struct tm6000_core *dev = ir->dev;
+       struct tm6000_core *dev;
        int pipe, size;
        int err = -ENOMEM;
 
        if (!ir)
                return -ENODEV;
+       dev = ir->dev;
 
        dprintk(2, "%s\n",__func__);