1. 08 Aug, 2018 14 commits
    • Mauro Carvalho Chehab's avatar
      media: isp: fix a warning about a wrong struct initializer · 6c33d826
      Mauro Carvalho Chehab authored
      As sparse complains:
      	drivers/media/platform/omap3isp/isp.c:303:39: warning: Using plain integer as NULL pointer
      
      when a struct is initialized with { 0 }, actually the first
      element of the struct is initialized with zeros, initializing the
      other elements recursively. That can even generate gcc warnings
      on nested structs.
      
      So, instead, use the gcc-specific syntax for that (with is used
      broadly inside the Kernel), initializing it with {};
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      6c33d826
    • Mauro Carvalho Chehab's avatar
      media: radio-wl1273: fix return code for the polling routine · dcefa533
      Mauro Carvalho Chehab authored
      All poll handlers should return a poll flag, and not error codes. So,
      instead of returning an error, do the right thing here,
      e. g. to return EPOLERR on errors, just like the V4L2 VB2 code.
      
      Solves the following sparse warning:
          drivers/media/radio/radio-wl1273.c:1099:24: warning: incorrect type in return expression (different base types)
          drivers/media/radio/radio-wl1273.c:1099:24:    expected restricted __poll_t
          drivers/media/radio/radio-wl1273.c:1099:24:    got int
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      dcefa533
    • Mauro Carvalho Chehab's avatar
      media: s3c-camif: fix return code for the polling routine · c46aa849
      Mauro Carvalho Chehab authored
      All poll handlers should return a poll flag, and not error codes. So,
      instead of returning an error, do the right thing here,
      e. g. to return EPOLERR on errors, just like the V4L2 VB2 code.
      
      Solves the following sparse warning:
          drivers/media/platform/s3c-camif/camif-capture.c:604:21: warning: incorrect type in assignment (different base types)
          drivers/media/platform/s3c-camif/camif-capture.c:604:21:    expected restricted __poll_t [usertype] ret
          drivers/media/platform/s3c-camif/camif-capture.c:604:21:    got int
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      c46aa849
    • Mauro Carvalho Chehab's avatar
      media: saa7164: fix return codes for the polling routine · 9de1be6e
      Mauro Carvalho Chehab authored
      All poll handlers should return a poll flag, and not error codes. So,
      instead of returning an error, do the right thing at saa7164,
      e. g. to return EPOLERR on errors, just like the V4L2 VB2 code.
      
      Solves the following sparse warnings:
          drivers/media/pci/saa7164/saa7164-vbi.c:632:24: warning: incorrect type in return expression (different base types)
          drivers/media/pci/saa7164/saa7164-vbi.c:632:24:    expected restricted __poll_t
          drivers/media/pci/saa7164/saa7164-vbi.c:632:24:    got int
          drivers/media/pci/saa7164/saa7164-vbi.c:637:40: warning: incorrect type in return expression (different base types)
          drivers/media/pci/saa7164/saa7164-vbi.c:637:40:    expected restricted __poll_t
          drivers/media/pci/saa7164/saa7164-vbi.c:637:40:    got int
          drivers/media/pci/saa7164/saa7164-vbi.c:647:40: warning: incorrect type in return expression (different base types)
          drivers/media/pci/saa7164/saa7164-vbi.c:647:40:    expected restricted __poll_t
          drivers/media/pci/saa7164/saa7164-vbi.c:647:40:    got int
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      9de1be6e
    • Mauro Carvalho Chehab's avatar
      media: exynos-gsc: fix return code if mutex was interrupted · 541b647a
      Mauro Carvalho Chehab authored
      All poll routines expect a poll flag, and not error codes. So,
      instead of returning -ERESTARTSYS if the mutex got interrupted,
      return EPOLERR, just like the V4L2 VB2 code.
      
      Solves this sparce warning:
      	drivers/media/platform/exynos-gsc/gsc-m2m.c:716:24: warning: incorrect type in return expression (different base types)
      	drivers/media/platform/exynos-gsc/gsc-m2m.c:716:24:    expected restricted __poll_t
      	drivers/media/platform/exynos-gsc/gsc-m2m.c:716:24:    got int
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      541b647a
    • Jacopo Mondi's avatar
      media: mt9v111: Fix build error with no VIDEO_V4L2_SUBDEV_API · 484f9b37
      Jacopo Mondi authored
      The v4l2_subdev_get_try_format() function is only defined if the
      VIDEO_V4L2_SUBDEV_API Kconfig option is enabled. Builds configured
      without that symbol fails with:
      
      drivers/media/i2c/mt9v111.c:801:10: error: implicit declaration of function
      'v4l2_subdev_get_try_format';
      
      Fix this by protecting the function call by testing for the right symbol.
      
      media: mt9v111: fix random build errors
      
      Fix the internal check for it to do the right thing if the
      subdev API is not built.
      
      Fixes: aab7ed1c ("media: i2c: Add driver for Aptina MT9V111")
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      484f9b37
    • Mauro Carvalho Chehab's avatar
      media: xc4000: get rid of uneeded casts · 8218840f
      Mauro Carvalho Chehab authored
      Instead of doing casts, use %zd to print sizes, in order to make
      smatch happier:
      	drivers/media/tuners/xc4000.c:818 xc4000_fwupload() warn: argument 4 to %d specifier is cast from pointer
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      8218840f
    • Mauro Carvalho Chehab's avatar
      media: drxj: get rid of uneeded casts · c4f04796
      Mauro Carvalho Chehab authored
      Instead of doing casts, use %zd to print sizes, in order to make
      smatch happier:
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11814 drx_ctrl_u_code() warn: argument 4 to %u specifier is cast from pointer
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11845 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11869 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11878 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      c4f04796
    • Mauro Carvalho Chehab's avatar
      media: tuner-xc2028: don't use casts for printing sizes · 3fcb3c83
      Mauro Carvalho Chehab authored
      Makes smatch happier by using %zd instead of casting sizes:
      	drivers/media/tuners/tuner-xc2028.c:378 load_all_firmwares() warn: argument 4 to %d specifier is cast from pointer
      	drivers/media/tuners/tuner-xc2028.c:619 load_firmware() warn: argument 6 to %d specifier is cast from pointer
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      3fcb3c83
    • Mauro Carvalho Chehab's avatar
      media: cleanup fall-through comments · 40e43111
      Mauro Carvalho Chehab authored
      As Ian pointed out, adding a '-' to the fallthrough seems to meet
      the regex requirements at level 3 of the warning, at least when
      the comment fits into a single line.
      
      So, replace by a single line the comments that were broken into
      multiple lines just to make gcc -Wimplicit-fallthrough=3 happy.
      Suggested-by: default avatarIan Arkver <ian.arkver.dev@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      40e43111
    • Mauro Carvalho Chehab's avatar
      media: vivid: shut up warnings due to a non-trivial logic · 3354b54f
      Mauro Carvalho Chehab authored
      The vivid driver uses a complex logic to save one kalloc/kfree
      allocation. That non-trivial way of allocating data causes
      smatch to warn:
      	drivers/media/platform/vivid/vivid-core.c:869 vivid_create_instance() warn: potentially one past the end of array 'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'
      	drivers/media/platform/vivid/vivid-core.c:869 vivid_create_instance() warn: potentially one past the end of array 'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'
      
      I also needed to read the code several times in order to understand
      what it was desired there. It turns that the logic was right,
      although confusing to read.
      
      As it is doing allocations on a non-standard way, let's add some
      documentation while shutting up the false positive.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      3354b54f
    • Mauro Carvalho Chehab's avatar
      media: rtl28xxu: be sure that it won't go past the array size · 845b978a
      Mauro Carvalho Chehab authored
      smatch warns that the RC query code could go past the array size:
      
      	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1757 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130
      	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1758 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130
      
      The driver logic gets the length of the IR RX buffer with:
      
              ret = rtl28xxu_rd_reg(d, IR_RX_BC, &buf[0]);
      	...
              len = buf[0];
      
      In thesis, this could range between 0 and 255 [1].
      
      While this should never happen in practice, due to hardware limits,
      smatch is right when it complains about that, as there's nothing at
      the logic that would prevent it. So, if for whatever reason, buf[0]
      gets filled by rtl28xx read functions with a value bigger than 128,
      it will go past the array.
      
      So, add an explicit check.
      
      [1] I've no idea why smatch thinks that the maximum value is 130.
      I double-checked the code several times. Was unable to find any
      reason for assuming 130. Perhaps smatch is not properly parsing
      u8 here?
      
      Fixes: b5cbaa43 ("[media] rtl28xx: initial support for rtl2832u")
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      845b978a
    • Mauro Carvalho Chehab's avatar
      media: mt9v111: avoid going past the buffer · d9a71866
      Mauro Carvalho Chehab authored
      As warned by smatch:
      	drivers/media/i2c/mt9v111.c:854 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      	drivers/media/i2c/mt9v111.c:855 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      	drivers/media/i2c/mt9v111.c:856 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      	drivers/media/i2c/mt9v111.c:857 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      d9a71866
    • Mauro Carvalho Chehab's avatar
      media: vsp1_dl: add a description for cmdpool field · 75070c6a
      Mauro Carvalho Chehab authored
      Gets rid of this build warning:
      	drivers/media/platform/vsp1/vsp1_dl.c:229: warning: Function parameter or member 'cmdpool' not described in 'vsp1_dl_manager'
      
      Fixes: f3b98e3c ("media: vsp1: Provide support for extended command pools")
      Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      75070c6a
  2. 07 Aug, 2018 4 commits
  3. 03 Aug, 2018 22 commits