llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [pinchartl:nxp/v6.10/dev/rpi-cam-mipi 46/81] drivers/media/i2c/ar0144.c:470:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false
Date: Sat, 15 Jun 2024 22:36:40 +0800	[thread overview]
Message-ID: <202406152210.BoPs7o2U-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git nxp/v6.10/dev/rpi-cam-mipi
head:   5a42e32f7a80b2729b81fa757c9531a7ec7127f9
commit: a082838244bc3478b888d88e932e5afe6a361b49 [46/81] media: i2c: ar0144: Refactor s_stream
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240615/202406152210.BoPs7o2U-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240615/202406152210.BoPs7o2U-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406152210.BoPs7o2U-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/media/i2c/ar0144.c:470:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     470 |         if (enable) {
         |             ^~~~~~
   drivers/media/i2c/ar0144.c:489:9: note: uninitialized use occurs here
     489 |         return ret;
         |                ^~~
   drivers/media/i2c/ar0144.c:470:2: note: remove the 'if' if its condition is always true
     470 |         if (enable) {
         |         ^~~~~~~~~~~
     471 |                 ret = pm_runtime_resume_and_get(sensor->dev);
     472 |                 if (ret < 0)
     473 |                         goto unlock;
     474 | 
     475 |                 ret = ar0144_start_streaming(sensor, state);
     476 |                 if (ret) {
     477 |                         dev_err(sensor->dev, "Failed to start streaming: %d\n",
     478 |                                 ret);
     479 |                         pm_runtime_put_sync(sensor->dev);
     480 |                 }
     481 |         } else {
         |           ~~~~~~
     482 |                 ar0144_stop_streaming(sensor);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     483 |                 pm_runtime_mark_last_busy(sensor->dev);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     484 |                 pm_runtime_put_autosuspend(sensor->dev);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     485 |         }
         |         ~
   drivers/media/i2c/ar0144.c:466:9: note: initialize the variable 'ret' to silence this warning
     466 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +470 drivers/media/i2c/ar0144.c

   457	
   458	/* -----------------------------------------------------------------------------
   459	 * V4L2 subdev operations
   460	 */
   461	
   462	static int ar0144_s_stream(struct v4l2_subdev *subdev, int enable)
   463	{
   464		struct ar0144 *sensor = to_ar0144(subdev);
   465		struct v4l2_subdev_state *state;
   466		int ret;
   467	
   468		state = v4l2_subdev_lock_and_get_active_state(subdev);
   469	
 > 470		if (enable) {
   471			ret = pm_runtime_resume_and_get(sensor->dev);
   472			if (ret < 0)
   473				goto unlock;
   474	
   475			ret = ar0144_start_streaming(sensor, state);
   476			if (ret) {
   477				dev_err(sensor->dev, "Failed to start streaming: %d\n",
   478					ret);
   479				pm_runtime_put_sync(sensor->dev);
   480			}
   481		} else {
   482			ar0144_stop_streaming(sensor);
   483			pm_runtime_mark_last_busy(sensor->dev);
   484			pm_runtime_put_autosuspend(sensor->dev);
   485		}
   486	
   487	unlock:
   488		v4l2_subdev_unlock_state(state);
   489		return ret;
   490	}
   491	

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

                 reply	other threads:[~2024-06-15 14:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202406152210.BoPs7o2U-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).