Re: [PATCH] media: Add t4ka3 camera sensor driver

From: kernel test robot
Date: Thu Oct 03 2024 - 07:24:42 EST


Hi Kate,

kernel test robot noticed the following build warnings:

[auto build test WARNING on media-tree/master]
[also build test WARNING on linuxtv-media-stage/master sailus-media-tree/master linus/master v6.12-rc1 next-20241003]
[cannot apply to sailus-media-tree/streams]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Kate-Hsuan/media-Add-t4ka3-camera-sensor-driver/20241002-173303
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/20241002093037.50875-1-hpa%40redhat.com
patch subject: [PATCH] media: Add t4ka3 camera sensor driver
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20241003/202410031909.fcXYISbG-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241003/202410031909.fcXYISbG-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410031909.fcXYISbG-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/media/i2c/t4ka3.c:628:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
628 | if (sensor->streaming == enable) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/t4ka3.c:689:9: note: uninitialized use occurs here
689 | return ret;
| ^~~
drivers/media/i2c/t4ka3.c:628:2: note: remove the 'if' if its condition is always false
628 | if (sensor->streaming == enable) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
629 | dev_warn(sensor->dev, "Stream already %s\n", enable ? "started" : "stopped");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
630 | goto error_unlock;
| ~~~~~~~~~~~~~~~~~~
631 | }
| ~
drivers/media/i2c/t4ka3.c:624:9: note: initialize the variable 'ret' to silence this warning
624 | int ret;
| ^
| = 0
1 warning generated.


vim +628 drivers/media/i2c/t4ka3.c

620
621 static int t4ka3_s_stream(struct v4l2_subdev *sd, int enable)
622 {
623 struct t4ka3_data *sensor = to_t4ka3_sensor(sd);
624 int ret;
625
626 mutex_lock(&sensor->lock);
627
> 628 if (sensor->streaming == enable) {
629 dev_warn(sensor->dev, "Stream already %s\n", enable ? "started" : "stopped");
630 goto error_unlock;
631 }
632
633 if (enable) {
634 ret = pm_runtime_get_sync(sensor->sd.dev);
635 if (ret) {
636 dev_err(sensor->dev, "power-up err.\n");
637 goto error_unlock;
638 }
639
640 cci_multi_reg_write(sensor->regmap, t4ka3_init_config,
641 ARRAY_SIZE(t4ka3_init_config), &ret);
642 /* enable group hold */
643 cci_write(sensor->regmap, T4KA3_REG_PARAM_HOLD, 1, &ret);
644 cci_multi_reg_write(sensor->regmap, t4ka3_pre_mode_set_regs,
645 ARRAY_SIZE(t4ka3_pre_mode_set_regs), &ret);
646 if (ret)
647 goto error_powerdown;
648
649 ret = t4ka3_set_mode(sensor);
650 if (ret)
651 goto error_powerdown;
652
653 ret = cci_multi_reg_write(sensor->regmap, t4ka3_post_mode_set_regs,
654 ARRAY_SIZE(t4ka3_post_mode_set_regs), NULL);
655 if (ret)
656 goto error_powerdown;
657
658 /* Restore value of all ctrls */
659 ret = __v4l2_ctrl_handler_setup(&sensor->ctrls.handler);
660 if (ret)
661 goto error_powerdown;
662
663 /* disable group hold */
664 cci_write(sensor->regmap, T4KA3_REG_PARAM_HOLD, 0, &ret);
665 cci_write(sensor->regmap, T4KA3_REG_STREAM, 1, &ret);
666 if (ret)
667 goto error_powerdown;
668
669 sensor->streaming = 1;
670 } else {
671 ret = cci_write(sensor->regmap, T4KA3_REG_STREAM, 0, NULL);
672 if (ret)
673 goto error_powerdown;
674
675 ret = pm_runtime_put(sensor->sd.dev);
676 if (ret)
677 goto error_unlock;
678
679 sensor->streaming = 0;
680 }
681
682 mutex_unlock(&sensor->lock);
683 return ret;
684
685 error_powerdown:
686 ret = pm_runtime_put(sensor->sd.dev);
687 error_unlock:
688 mutex_unlock(&sensor->lock);
689 return ret;
690 }
691

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki