1. 03 Sep, 2020 33 commits
    • Mauro Carvalho Chehab's avatar
      media: atomisp: get rid of some unused code · 929e2a61
      Mauro Carvalho Chehab authored
      Now that the defines which are common for both ISP2400 and ISP2401
      are at system_global.h, we can get rid of the code not used by
      those versions.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      929e2a61
    • Mauro Carvalho Chehab's avatar
      media: atomisp: csi_rx.c: add missing includes · 6db1bd61
      Mauro Carvalho Chehab authored
      Due to that, smatch warns with:
      
      	drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:18:11:  warning: symbol 'N_SHORT_PACKET_LUT_ENTRIES' was not declared. Should it be static?
      	drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:24:11:  warning: symbol 'N_LONG_PACKET_LUT_ENTRIES' was not declared. Should it be static?
      	drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:30:11:  warning: symbol 'N_CSI_RX_FE_CTRL_DLANES' was not declared. Should it be static?
      	drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:37:11:  warning: symbol 'N_CSI_RX_BE_SID_WIDTH' was not declared. Should it be static?
      	drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c:19:11:  warning: symbol 'N_IBUF_CTRL_PROCS' was not declared. Should it be static?
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      6db1bd61
    • Mauro Carvalho Chehab's avatar
      media: atomisp: atomisp_gmin_platform: check before use · 815ac856
      Mauro Carvalho Chehab authored
      solve this smatch warning:
      	drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:842 gmin_v1p8_ctrl() warn: variable dereferenced before check 'gs' (see line 832)
      
      By moving the check to happen before its usage.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      815ac856
    • Mauro Carvalho Chehab's avatar
      media: atomisp: fix casts at atomisp_compat_ioctl32.c · b2999af9
      Mauro Carvalho Chehab authored
      There are several warnings reported by sparse with regards to wrong
      typecasts:
      
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13:     expected void *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13:     expected unsigned int [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13:     expected unsigned int [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13:     expected unsigned int [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13:     expected unsigned int [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30:  warning: incorrect type in argument 2 (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30:     expected void const *from
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30:     got struct atomisp_3a_statistics [noderef] __user *kp
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13:     expected unsigned int [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13:     expected void [noderef] __user *effective_width
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13:     got unsigned int [usertype] *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13:     expected void [noderef] __user *effective_width
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13:     got unsigned int [usertype] *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13:     expected unsigned int [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13:     expected struct v4l2_framebuffer *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13:     expected void [noderef] __user *frame
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13:     got struct v4l2_framebuffer *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13:     expected unsigned short *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13:     expected void [noderef] __user *calb_grp_values
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13:     got unsigned short *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21:     expected unsigned short [usertype] *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27:  warning: cast removes address space '__user' of expression
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27:  warning: incorrect type in initializer (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27:     expected struct <noident> [noderef] __user *karg
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27:     got void *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:721:39:  warning: cast removes address space '__user' of expression
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21:  warning: incorrect type in argument 1 (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21:     expected void const volatile [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21:     got unsigned int [usertype] *src
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43:     expected void *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43:     got void [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21:     expected struct atomisp_shading_table *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21:     got struct atomisp_shading_table [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21:     expected struct atomisp_morph_table *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21:     got struct atomisp_morph_table [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21:     expected struct atomisp_dis_coefficients *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21:     got struct atomisp_dis_coefficients [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14:     expected struct atomisp_dvs_6axis_config *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14:     got struct atomisp_dvs_6axis_config [noderef] __user *
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13:  warning: incorrect type in assignment (different address spaces)
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13:     expected struct atomisp_sensor_ae_bracketing_lut_entry *__pu_val
          drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13:     got void [noderef] __user *
      
      Use the same strategies used at v4l2-compat32.c, in order to
      solve them and avoid warnings.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      b2999af9
    • Mauro Carvalho Chehab's avatar
      media: saa7134: avoid a shift overflow · 15a36aae
      Mauro Carvalho Chehab authored
      As reported by smatch:
      	drivers/media/pci/saa7134//saa7134-tvaudio.c:686 saa_dsp_writel() warn: should 'reg << 2' be a 64 bit type?
      
      On a 64-bits Kernel, the shift might be bigger than 32 bits.
      
      In real, this should never happen, but let's shut up the warning.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      15a36aae
    • Mauro Carvalho Chehab's avatar
      media: dvb-ttusb-budget: cleanup printk logic · 883c84ac
      Mauro Carvalho Chehab authored
      Instead of calling printk(), use pr_foo() macros.
      
      While here, do some cleanup at the printed messages, as some
      has __func__, while others have the module name (sometimes
      spelled as "ttusb_dvb").
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      883c84ac
    • Mauro Carvalho Chehab's avatar
      media: dvb-ttusb-budget: don't use stack for USB transfers · 36e3cf0c
      Mauro Carvalho Chehab authored
      As reported by smatch:
      
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:311 ttusb_boot_dsp() error: doing dma on the stack (b)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:321 ttusb_boot_dsp() error: doing dma on the stack (b)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:330 ttusb_boot_dsp() error: doing dma on the stack (b)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:351 ttusb_set_channel() error: doing dma on the stack (b)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:361 ttusb_del_channel() error: doing dma on the stack (b)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:412 ttusb_init_controller() error: doing dma on the stack (b0)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:416 ttusb_init_controller() error: doing dma on the stack (b1)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:422 ttusb_init_controller() error: doing dma on the stack (b2)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:425 ttusb_init_controller() error: doing dma on the stack (b3)
          drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:430 ttusb_init_controller() error: doing dma on the stack (get_version)
      
      This driver still uses the USB stack for DMA transfers,
      which is broken for a long time. I almost dropped this driver,
      as there's a high chance that nobody is using it with upstream
      Kernels, as we didn't receive any bug reports.
      
      As fixing this won't be hard, I ended opting to fix.
      
      While here, I dropped an ugly hack that implemented read via
      a separate function that was just doing a memcpy().
      
      It should be noticed that, during the init phase, there's
      a "b4" register that were never initialized, as its buffer
      were used just to store the results of "b3" initialization.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      36e3cf0c
    • Mauro Carvalho Chehab's avatar
      media: saa7134-alsa.c: number of pages should be unsigned long · c91effc0
      Mauro Carvalho Chehab authored
      As reported by smatch:
      
      	drivers/media/pci/saa7134/saa7134-alsa.c:267 saa7134_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?
      
      the number of patches should be unsigned long.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      c91effc0
    • Mauro Carvalho Chehab's avatar
      media: cx88-alsa: number of pages should be unsigned long · b4e0a5f9
      Mauro Carvalho Chehab authored
      As reported by smatch:
      
      	drivers/media/pci/cx88/cx88-alsa.c:286 cx88_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?
      
      the number of patches should be unsigned long.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      b4e0a5f9
    • Mauro Carvalho Chehab's avatar
      media: cx23885-alsa: number of pages should be unsigned long · 74637731
      Mauro Carvalho Chehab authored
      As reported by smatch:
      
      	drivers/media//pci/cx23885/cx23885-alsa.c:83 cx23885_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?
      
      the number of patches should be unsigned long.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      74637731
    • Mauro Carvalho Chehab's avatar
      media: cx25821-alsa: number of pages should be unsigned long · 99c2ec04
      Mauro Carvalho Chehab authored
      As reported by smatch:
      
      	drivers/media/pci/cx25821/cx25821-alsa.c:146 cx25821_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?
      
      the number of patches should be unsigned long.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      99c2ec04
    • Mauro Carvalho Chehab's avatar
      media: videobuf-dma-sg: number of pages should be unsigned long · 1faa39e0
      Mauro Carvalho Chehab authored
      As reported by smatch:
      
      	drivers/media/v4l2-core/videobuf-dma-sg.c:245 videobuf_dma_init_kernel() warn: should 'nr_pages << 12' be a 64 bit type?
      
      The printk should not be using %d for the number of pages.
      
      After looking better, the real problem here is that the
      number of pages should be long int.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      1faa39e0
    • Mauro Carvalho Chehab's avatar
      media: serial_ir: use the right type for a dma address · 73c01654
      Mauro Carvalho Chehab authored
      As warned by smatch:
      	drivers/media/rc/serial_ir.c:550 serial_ir_probe() warn: should '8 << ioshift' be a 64 bit type?
      
      the "8" constant should be unsigned long.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      73c01654
    • Mauro Carvalho Chehab's avatar
      media: tda10021: avoid casts when using symbol_rate · 3f83aa6b
      Mauro Carvalho Chehab authored
      The usage of castings and float point when checking for
      the setup based at the symbol_rate cause those warnings
      with smatch:
      
      	drivers/media/dvb-frontends/tda10021.c:153 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
      	drivers/media/dvb-frontends/tda10021.c:155 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
      	drivers/media/dvb-frontends/tda10021.c:157 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
      	drivers/media/dvb-frontends/tda10021.c:159 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
      
      While the code should work with gcc, as it will evaluate the
      values into a constant before compiling, other compilers
      could do otherwise. So, get rid of float pointing math on it,
      avoiding the need of doing typecasts.
      
      While here, cleanup some coding style issues at the related
      code.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      3f83aa6b
    • Mauro Carvalho Chehab's avatar
      media: venus: place extern venus_fw_debug on a header file · 10f07a6b
      Mauro Carvalho Chehab authored
      Sparse warns about this symbol:
      
      	drivers/media/platform/qcom/venus/hfi_venus.c:133:5:  warning: symbol 'venus_fw_debug' was not declared. Should it be static?
      
      Because hfi_venus.c doesn't include a header file with the
      extern. So, move it to core.h, with is included by both
      hfi_venus.c and dbgfs.c.
      
      This way, if something changes with it, warnings or errors
      will be produced.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      10f07a6b
    • Mauro Carvalho Chehab's avatar
      media: wl128x: get rid of a potential spectre issue · e4969cff
      Mauro Carvalho Chehab authored
      As reported by smatch:
      	drivers/media/radio/wl128x/fmdrv_common.c:736 fm_irq_handle_rdsdata_getcmd_resp() warn: potential spectre issue 'rds_fmt.data.groupdatabuff.buff>
      
      Address it by using array_index_nospec().
      
      While here, reorder the linux/ includes.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      e4969cff
    • Mauro Carvalho Chehab's avatar
      media: av7110_v4l: avoid a typecast · 13c12906
      Mauro Carvalho Chehab authored
      While smatch reports an issue there:
      
      	drivers/media/pci/ttpci/av7110_v4l.c:163 ves1820_set_tv_freq() warn: unsigned 'freq' is never less than zero.
      	drivers/media/pci/ttpci/av7110_v4l.c:165 ves1820_set_tv_freq() warn: unsigned 'freq' is never less than zero.
      
      The logic is actually fine. Yet, removing the typecast
      shuts up smatch and makes the code more readable.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      13c12906
    • Mauro Carvalho Chehab's avatar
      media: qt1010: fix usage of unititialized value · 7a9b5612
      Mauro Carvalho Chehab authored
      As pointed by smatch:
      
      	drivers/media/tuners/qt1010.c:239 qt1010_init_meas1() error: uninitialized symbol 'val2'.
      	drivers/media/tuners/qt1010.c:273 qt1010_init_meas2() error: uninitialized symbol 'val'.
      
      The logic is ok, but it is hard for static analyzers
      to parse it, as it depends on a value read in the middle
      of a loop.
      
      Also, it takes a while for humans to verify.
      
      Re-write the first function to use a more direct way.
      
      At the second one, I opted to just initialize the read var,
      in order to shut up the report.
      
      While here, address a few coding style issues at the
      function code.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      7a9b5612
    • Mauro Carvalho Chehab's avatar
      media: tda10086: cleanup symbol_rate setting logic · ddc11db2
      Mauro Carvalho Chehab authored
      The original logic had an integer to unsigned integer
      conversion, plus a float-point math. While gcc should be
      able to do the match at compile time, other compilers might
      not do the same. Also, those produce the following warnings
      with static code analyzers:
      
      	drivers/media/dvb-frontends/tda10086.c:300 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:303 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:306 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:309 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:312 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:315 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:318 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:321 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:324 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      	drivers/media/dvb-frontends/tda10086.c:327 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
      
      Change the logic to declare the reference constant as unsigned
      and to not use float point math.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      ddc11db2
    • Anant Thazhemadam's avatar
      media: atomisp: fix "dubious: !x | !y" sparse warning · a4f37617
      Anant Thazhemadam authored
      Upon running Sparse, "warning: dubious: !x | !y" is brought to notice
      for this file.  Logical and bitwise OR are basically the same in this
      context, so it doesn't cause a runtime bug.  But let's change it to
      logical OR to make it a little bit cleaner and silence the Sparse
      warning.
      Signed-off-by: default avatarAnant Thazhemadam <anant.thazhemadam@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      a4f37617
    • Joe Perches's avatar
      media: atomisp: Avoid comma separated statements · 01049493
      Joe Perches authored
      Use semicolons and braces.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      01049493
    • Dinghao Liu's avatar
      media: atomisp: fix memleak in ia_css_stream_create · c1bca5b5
      Dinghao Liu authored
      When aspect_ratio_crop_init() fails, curr_stream needs
      to be freed just like what we've done in the following
      error paths. However, current code is returning directly
      and ends up leaking memory.
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      c1bca5b5
    • Colin Ian King's avatar
      media: atomisp: fix spelling mistake "unsupport" -> "unsupported" · 5b4b0978
      Colin Ian King authored
      There are spelling mistakes in some dev_err messages. Fix these.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      5b4b0978
    • Cengiz Can's avatar
      media: atomisp: move null check to earlier point · 9b734bb9
      Cengiz Can authored
      `find_gmin_subdev()` that returns a pointer to `struct
      gmin_subdev` can return NULL.
      
      In `gmin_v2p8_ctrl()` there's a call to this function but the
      possibility of a NULL was not checked before its being dereferenced,
      i.e.:
      
        /* Acquired here --------v */
        struct gmin_subdev *gs = find_gmin_subdev(subdev);
      
        /*  v------Dereferenced here */
        if (gs->v2p8_gpio >= 0) {
            ...
        }
      
      With this change we're null checking `find_gmin_subdev()` result
      and we return an error if that's the case. We also WARN()
      for the sake of debugging.
      Signed-off-by: default avatarCengiz Can <cengiz@kernel.wtf>
      Reported-by: Coverity Static Analyzer CID 1465536
      Suggested-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      9b734bb9
    • Juan Antonio Aldea-Armenteros's avatar
      media: atomisp: mt9m114: replace fixed function names · 8d1fdaa5
      Juan Antonio Aldea-Armenteros authored
      There are a couple of debug messages using hardcoded function names
      instead of the preferred __func__ magic constant.
      
      Replace them:
      
      WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string
      215: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:215:
      +       v4l2_err(client, "misensor_rmw_reg error exit, read failed\n");
      
      WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string
      236: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:236:
      +       v4l2_err(client, "misensor_rmw_reg error exit, write failed\n");
      Signed-off-by: default avatarJuan Antonio Aldea-Armenteros <juant.aldea@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      8d1fdaa5
    • Rohit K Bharadwaj's avatar
      media: atomisp: fix code style issues · 714d85f0
      Rohit K Bharadwaj authored
      Fix warnings and errors generated after running checkpatch.pl on pci/sh_css_firmware.c.
      Signed-off-by: default avatarRohit K Bharadwaj <bharadwaj.rohit8@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      714d85f0
    • Suraj Upadhyay's avatar
      media: atomisp: Replace deprecated MSI APIs · 02900a49
      Suraj Upadhyay authored
      Replace deprecated MSI IRQ enabler and disabler
      with pci_alloc_irq_vectors and pci_free_irq_vectors respectively.
      And as a result handle the returned error as appropriate.
      Compile tested.
      
      [mchehab: solved a merge conflict that renamed dev->pdev]
      Signed-off-by: default avatarSuraj Upadhyay <usuraj35@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      02900a49
    • Mauro Carvalho Chehab's avatar
      media: atomisp: fix identation at I2C Kconfig menu · ed99640d
      Mauro Carvalho Chehab authored
      There are several bad whitespacing usage there. Remove them.
      
      While here, place all Kconfig options for sensors at the
      same place.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      ed99640d
    • Ankit Baluni's avatar
      media: atomisp: fix a brace coding sytle issue · d221d209
      Ankit Baluni authored
      Removed braces in 'if else' condition as it only consists of
      one line each and according to coding style rules , in this case
      the braces are not required.
      Signed-off-by: default avatarAnkit Baluni <b18007@students.iitmandi.ac.in>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      d221d209
    • Aditya Jain's avatar
      media: atomisp: Fix braces placement coding style errors · 7e023a1c
      Aditya Jain authored
      Fix braces placement errors as reported by checkpatch.pl
      Signed-off-by: default avatarAditya Jain <aditya.jainadityajain.jain@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      7e023a1c
    • Ankit Baluni's avatar
      media: atomisp: fixed a brace coding sytle issue · f95cb3dd
      Ankit Baluni authored
      Removed braces for a 'if' condition as it contain only single line &
      there is no need for braces for such case according to coding style
      rules.
      Signed-off-by: default avatarAnkit Baluni <b18007@students.iitmandi.ac.in>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      f95cb3dd
    • Rahul Gottipati's avatar
      media: atomisp: coding style: correct multiline comments · 53975388
      Rahul Gottipati authored
      This fixes some coding style issues of multiline comments to
      correct a few checkpatch.pl warnings.
      Signed-off-by: default avatarRahul Gottipati <rahul.blr97@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      53975388
    • Rahul Gottipati's avatar
      media: atomisp: coding style: remove beginning whitespaces · 1b24a572
      Rahul Gottipati authored
      This removes whitespaces at the beginning of a few lines to fix
      some checkpatch.pl warnings.
      Signed-off-by: default avatarRahul Gottipati <rahul.blr97@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      1b24a572
  2. 01 Sep, 2020 7 commits