1. 16 Aug, 2015 5 commits
    • Jan Kara's avatar
      [media] vb2: Push mmap_sem down to memops · 0f6e2825
      Jan Kara authored
      Currently vb2 core acquires mmap_sem just around call to
      __qbuf_userptr(). However since commit f035eb4e
      
       (videobuf2: fix
      lockdep warning) it isn't necessary to acquire it so early as we no
      longer have to drop queue mutex before acquiring mmap_sem. So push
      acquisition of mmap_sem down into .get_userptr memop so that the
      semaphore is acquired for a shorter time and it is clearer what it is
      needed for.
      
      Note that we also need mmap_sem in .put_userptr memop since that ends up
      calling vb2_put_vma() which calls vma->vm_ops->close() which should be
      called with mmap_sem held. However we didn't hold mmap_sem in some code
      paths anyway (e.g. when called via vb2_ioctl_reqbufs() ->
      __vb2_queue_free() -> vb2_dma_sg_put_userptr()) and getting mmap_sem in
      put_userptr() introduces a lock inversion with queue->mmap_lock in the
      above mentioned call path.
      
      Luckily this whole locking mess will get resolved once we convert
      videobuf2 core to the new mm helper which avoids the need for mmap_sem
      in .put_userptr memop altogether.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      0f6e2825
    • Mauro Carvalho Chehab's avatar
      [media] sr030pc30: don't read a new pointer · 27c03975
      Mauro Carvalho Chehab authored
      
      
      sr030pc30_get_fmt() can only succeed if both info->curr_win and
      info->curr_fmt are not NULL.
      
      If one of those vars are null, the curent code would call:
      	ret = sr030pc30_set_params(sd);
      
      If the curr_win is null, it will return -EINVAL, as it would be
      expected. However, if curr_fmt is NULL, the function won't
      set it.
      
      The code will then try to read from it:
      
              mf->code        = info->curr_fmt->code;
              mf->colorspace  = info->curr_fmt->colorspace;
      
      with obviouly won't work.
      
      This got reported by smatch:
      	drivers/media/i2c/sr030pc30.c:505 sr030pc30_get_fmt() error: we previously assumed 'info->curr_win' could be null (see line 499)
      	drivers/media/i2c/sr030pc30.c:507 sr030pc30_get_fmt() error: we previously assumed 'info->curr_fmt' could be null (see line 499)
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      27c03975
    • Mauro Carvalho Chehab's avatar
      [media] ov2659: get rid of unused values · ab9a953b
      Mauro Carvalho Chehab authored
      
      
      Why to store the chosed values for prediv, postdiv and mult if
      those won't be used?
      
      drivers/media/i2c/ov2659.c: In function 'ov2659_pll_calc_params':
      drivers/media/i2c/ov2659.c:912:35: warning: variable 's_mult' set but not used [-Wunused-but-set-variable]
        u32 s_prediv = 1, s_postdiv = 1, s_mult = 1;
                                         ^
      drivers/media/i2c/ov2659.c:912:20: warning: variable 's_postdiv' set but not used [-Wunused-but-set-variable]
        u32 s_prediv = 1, s_postdiv = 1, s_mult = 1;
                          ^
      drivers/media/i2c/ov2659.c:912:6: warning: variable 's_prediv' set but not used [-Wunused-but-set-variable]
        u32 s_prediv = 1, s_postdiv = 1, s_mult = 1;
            ^
      
      This is likely some leftover from some past change.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      ab9a953b
    • Mauro Carvalho Chehab's avatar
      [media] ov9650: remove an extra space · 12976516
      Mauro Carvalho Chehab authored
      
      
      drivers/media/i2c/ov9650.c:1439 ov965x_detect_sensor() warn: inconsistent indenting
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      12976516
    • Mauro Carvalho Chehab's avatar
      [media] tc358743: don't use variable length array for I2C writes · 1d88f831
      Mauro Carvalho Chehab authored
      
      
      drivers/media/i2c/tc358743.c:148:19: warning: Variable length array is used.
      
      As the maximum size is 1026, we can't use dynamic var, as it
      would otherwise spend 1056 bytes of the stack at i2c_wr() function.
      
      So, allocate a buffer with the allowed maximum size together with
      the state var.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Acked-by: default avatarMats Randgaard <matrandg@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      1d88f831
  2. 11 Aug, 2015 35 commits