Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: i2c: st-vgxy61: Fix smatch warnings

Fix some 'vgxy61_write_reg' return vars not being signed int.
Fix 'expo_long_max' not being initialized.
Handle 'pm_runtime_get_sync' call that can return 1.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Benjamin Mugnier and committed by
Mauro Carvalho Chehab
483af3fe 3295abd1

+10 -9
+10 -9
drivers/media/i2c/st-vgxy61.c
··· 885 885 unsigned int idx) 886 886 { 887 887 static const u8 index2val[] = {0x0, 0x1, 0x3}; 888 - u16 reg; 888 + int reg; 889 889 890 890 reg = vgxy61_read_reg(sensor, VGXY61_REG_SIGNALS_CTRL); 891 891 if (reg < 0) ··· 988 988 u16 new_expo_short = 0; 989 989 u16 expo_short_max = 0; 990 990 u16 expo_long_min = VGXY61_MIN_EXPOSURE; 991 - u16 expo_long_max; 991 + u16 expo_long_max = 0; 992 992 993 993 /* Compute short exposure according to hdr mode and long exposure */ 994 994 switch (hdr) { ··· 1173 1173 pm_runtime_put_autosuspend(&client->dev); 1174 1174 return ret; 1175 1175 } 1176 + 1177 + /* pm_runtime_get_sync() can return 1 as a valid return code */ 1178 + ret = 0; 1176 1179 1177 1180 vgxy61_write_reg(sensor, VGXY61_REG_FORMAT_CTRL, 1178 1181 get_bpp_by_code(sensor->fmt.code), &ret); ··· 1568 1565 { 1569 1566 u32 sensor_freq; 1570 1567 u8 prediv, mult; 1571 - u16 line_length; 1568 + int line_length; 1572 1569 int ret = 0; 1573 1570 1574 1571 compute_pll_parameters_by_freq(sensor->clk_freq, &prediv, &mult); ··· 1609 1606 static int vgxy61_patch(struct vgxy61_dev *sensor) 1610 1607 { 1611 1608 struct i2c_client *client = sensor->i2c_client; 1612 - u16 patch; 1613 - int ret; 1609 + int patch, ret; 1614 1610 1615 1611 ret = vgxy61_write_array(sensor, VGXY61_REG_FWPATCH_START_ADDR, 1616 1612 sizeof(patch_array), patch_array); ··· 1647 1645 static int vgxy61_detect_cut_version(struct vgxy61_dev *sensor) 1648 1646 { 1649 1647 struct i2c_client *client = sensor->i2c_client; 1650 - u16 device_rev; 1648 + int device_rev; 1651 1649 1652 1650 device_rev = vgxy61_read_reg(sensor, VGXY61_REG_REVISION); 1653 1651 if (device_rev < 0) ··· 1673 1671 static int vgxy61_detect(struct vgxy61_dev *sensor) 1674 1672 { 1675 1673 struct i2c_client *client = sensor->i2c_client; 1676 - u16 id = 0; 1677 - int ret; 1678 - u8 st; 1674 + int id = 0; 1675 + int ret, st; 1679 1676 1680 1677 id = vgxy61_read_reg(sensor, VGXY61_REG_MODEL_ID); 1681 1678 if (id < 0)