linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [sailus-media-tree:metadata 76/77] drivers/media/v4l2-core/v4l2-subdev.c:2292:14: warning: variable 'is_source' set but not used
@ 2025-09-02 13:46 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-09-02 13:46 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: oe-kbuild-all, linux-media

tree:   git://linuxtv.org/sailus/media_tree.git metadata
head:   dbb6c78ee163822abba87ee352b67b7cfec3a023
commit: df6177be8173130bd39345bb16da0bd2a8787470 [76/77] source
config: i386-buildonly-randconfig-003-20250902 (https://download.01.org/0day-ci/archive/20250902/202509022128.hDkCkWCt-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250902/202509022128.hDkCkWCt-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/202509022128.hDkCkWCt-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/media/v4l2-core/v4l2-subdev.c: In function 'v4l2_subdev_enable_streams':
>> drivers/media/v4l2-core/v4l2-subdev.c:2292:14: warning: variable 'is_source' set but not used [-Wunused-but-set-variable]
    2292 |         bool is_source = true;
         |              ^~~~~~~~~


vim +/is_source +2292 drivers/media/v4l2-core/v4l2-subdev.c

  2282	
  2283	int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
  2284				       u64 streams_mask)
  2285	{
  2286		struct device *dev = sd->entity.graph_obj.mdev->dev;
  2287		struct v4l2_subdev_state *state;
  2288		u64 enabled_streams;
  2289		u64 found_streams;
  2290		bool already_streaming;
  2291		bool use_s_stream;
> 2292		bool is_source = true;
  2293		int ret;
  2294	
  2295		dev_dbg(dev, "enable streams \"%s\":%u/%#llx\n", sd->entity.name, pad,
  2296			streams_mask);
  2297	
  2298		/* A few basic sanity checks first. */
  2299		if (pad >= sd->entity.num_pads)
  2300			return -EINVAL;
  2301	
  2302		if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE))
  2303			return -EOPNOTSUPP;
  2304	
  2305		/*
  2306		 * We use a 64-bit bitmask for tracking enabled pads, so only subdevices
  2307		 * with 64 pads or less can be supported.
  2308		 */
  2309		if (pad >= sizeof(sd->enabled_pads) * BITS_PER_BYTE)
  2310			return -EOPNOTSUPP;
  2311	
  2312		if (!streams_mask)
  2313			return 0;
  2314	
  2315		/* Fallback on .s_stream() if .enable_streams() isn't available. */
  2316		use_s_stream = !v4l2_subdev_has_op(sd, pad, enable_streams);
  2317	
  2318		/* Figure out if the sub-device is a source sub-device. */
  2319		for (unsigned int i = 0; i < sd->entity.num_pads; i++) {
  2320			if (!(sd->entity.pads[i].flags & MEDIA_PAD_FL_SINK))
  2321				continue;
  2322	
  2323			is_source = false;
  2324			break;
  2325		}
  2326	
  2327		if (!use_s_stream)
  2328			state = v4l2_subdev_lock_and_get_active_state(sd);
  2329		else
  2330			state = NULL;
  2331	
  2332		/*
  2333		 * Verify that the requested streams exist and that they are not
  2334		 * already enabled.
  2335		 */
  2336	
  2337		v4l2_subdev_collect_streams(sd, state, pad, streams_mask,
  2338					    &found_streams, &enabled_streams);
  2339	
  2340		if (found_streams != streams_mask) {
  2341			dev_dbg(dev, "streams 0x%llx not found on %s:%u\n",
  2342				streams_mask & ~found_streams, sd->entity.name, pad);
  2343			ret = -EINVAL;
  2344			goto done;
  2345		}
  2346	
  2347		if (enabled_streams) {
  2348			dev_dbg(dev, "streams 0x%llx already enabled on %s:%u\n",
  2349				enabled_streams, sd->entity.name, pad);
  2350			ret = -EALREADY;
  2351			goto done;
  2352		}
  2353	
  2354		already_streaming = v4l2_subdev_is_streaming(sd);
  2355	
  2356		if (!use_s_stream) {
  2357			/* Call the .enable_streams() operation. */
  2358			ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad,
  2359					       streams_mask);
  2360		} else {
  2361			/* Start streaming when the first pad is enabled. */
  2362			if (!already_streaming)
  2363				ret = v4l2_subdev_call(sd, video, s_stream, 1);
  2364			else
  2365				ret = 0;
  2366		}
  2367	
  2368		if (ret) {
  2369			dev_dbg(dev, "enable streams %u:%#llx failed: %d\n", pad,
  2370				streams_mask, ret);
  2371			goto done;
  2372		}
  2373	
  2374		/* Mark the streams as enabled. */
  2375		v4l2_subdev_set_streams_enabled(sd, state, pad, streams_mask, true);
  2376	
  2377		/*
  2378		 * TODO: When all the drivers have been changed to use
  2379		 * v4l2_subdev_enable_streams() and v4l2_subdev_disable_streams(),
  2380		 * instead of calling .s_stream() operation directly, we can remove
  2381		 * the privacy LED handling from call_s_stream() and do it here
  2382		 * for all cases.
  2383		 */
  2384		if (!use_s_stream && !already_streaming)
  2385			v4l2_subdev_enable_privacy_led(sd);
  2386	
  2387	done:
  2388		if (!use_s_stream)
  2389			v4l2_subdev_unlock_state(state);
  2390	
  2391		return ret;
  2392	}
  2393	EXPORT_SYMBOL_GPL(v4l2_subdev_enable_streams);
  2394	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-02 13:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 13:46 [sailus-media-tree:metadata 76/77] drivers/media/v4l2-core/v4l2-subdev.c:2292:14: warning: variable 'is_source' set but not used kernel test robot

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).