[sailus-media-tree:test 19/20] drivers/media/v4l2-core/v4l2-subdev.c:1473:6: warning: variable 'ret' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://linuxtv.org/sailus/media_tree.git test
head:   1c12986c58defb1d262ac0fa851066fc724e617e
commit: 4c7fd566e013fd0ec5cfc3243b63bf2804c4e9fe [19/20] media: v4l2-subdev: Rename .init_cfg() operation to .init_state()
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231127/202311270412.AMfCcbby-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231127/202311270412.AMfCcbby-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/202311270412.AMfCcbby-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/media/v4l2-core/v4l2-subdev.c:1473:6: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
           if (ret < 0 && ret != -ENOIOCTLCMD)
               ^~~
   drivers/media/v4l2-core/v4l2-subdev.c:1439:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +/ret +1473 drivers/media/v4l2-core/v4l2-subdev.c

33c0ddbe56905c Tomi Valkeinen   2021-07-15  1433  
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1434  struct v4l2_subdev_state *
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1435  __v4l2_subdev_state_alloc(struct v4l2_subdev *sd, const char *lock_name,
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1436  			  struct lock_class_key *lock_key)
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1437  {
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1438  	struct v4l2_subdev_state *state;
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1439  	int ret;
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1440  
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1441  	state = kzalloc(sizeof(*state), GFP_KERNEL);
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1442  	if (!state)
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1443  		return ERR_PTR(-ENOMEM);
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1444  
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1445  	__mutex_init(&state->_lock, lock_name, lock_key);
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1446  	if (sd->state_lock)
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1447  		state->lock = sd->state_lock;
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1448  	else
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1449  		state->lock = &state->_lock;
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1450  
52c2575db8faa1 Sakari Ailus     2023-10-13  1451  	state->sd = sd;
52c2575db8faa1 Sakari Ailus     2023-10-13  1452  
2f91e10ee6fd4c Tomi Valkeinen   2021-12-21  1453  	/* Drivers that support streams do not need the legacy pad config */
2f91e10ee6fd4c Tomi Valkeinen   2021-12-21  1454  	if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS) && sd->entity.num_pads) {
8af592e2ecbcd2 Hans Verkuil     2022-05-02  1455  		state->pads = kvcalloc(sd->entity.num_pads,
8af592e2ecbcd2 Hans Verkuil     2022-05-02  1456  				       sizeof(*state->pads), GFP_KERNEL);
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1457  		if (!state->pads) {
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1458  			ret = -ENOMEM;
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1459  			goto err;
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1460  		}
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1461  	}
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1462  
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1463  	/*
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1464  	 * There can be no race at this point, but we lock the state anyway to
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1465  	 * satisfy lockdep checks.
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1466  	 */
4c7fd566e013fd Laurent Pinchart 2023-11-26  1467  	if (sd->internal_ops && sd->internal_ops->init_state) {
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1468  		v4l2_subdev_lock_state(state);
4c7fd566e013fd Laurent Pinchart 2023-11-26  1469  		sd->internal_ops->init_state(sd, state);
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1470  		v4l2_subdev_unlock_state(state);
4c7fd566e013fd Laurent Pinchart 2023-11-26  1471  	}
ed647ea668fb27 Tomi Valkeinen   2022-04-12  1472  
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10 @1473  	if (ret < 0 && ret != -ENOIOCTLCMD)
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1474  		goto err;
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1475  
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1476  	return state;
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1477  
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1478  err:
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1479  	if (state && state->pads)
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1480  		kvfree(state->pads);
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1481  
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1482  	kfree(state);
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1483  
0d346d2a6f54f0 Tomi Valkeinen   2021-06-10  1484  	return ERR_PTR(ret);
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1485  }
40aaab9d773b07 Tomi Valkeinen   2022-04-12  1486  EXPORT_SYMBOL_GPL(__v4l2_subdev_state_alloc);
9b02cbb3ede89b Laurent Pinchart 2015-04-24  1487  

:::::: The code at line 1473 was first introduced by commit
:::::: 0d346d2a6f54f06f36b224fd27cd6eafe8c83be9 media: v4l2-subdev: add subdev-wide state struct

:::::: TO: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>

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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux