[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202301050227.N3XUZsgu-lkp@intel.com>
Date: Thu, 5 Jan 2023 02:31:02 +0800
From: kernel test robot <lkp@...el.com>
To: Ricardo Ribalda <ribalda@...omium.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-media@...r.kernel.org,
Hans Verkuil <hverkuil@...all.nl>,
linux-kernel@...r.kernel.org,
Ricardo Ribalda <ribalda@...omium.org>
Subject: Re: [PATCH v3 8/8] media: uvcvideo: Use standard names for menus
Hi Ricardo,
I love your patch! Perhaps something to improve:
[auto build test WARNING on 69b41ac87e4a664de78a395ff97166f0b2943210]
url: https://github.com/intel-lab-lkp/linux/commits/Ricardo-Ribalda/media-uvcvideo-Check-for-INACTIVE-in-uvc_ctrl_is_accessible/20230103-223901
base: 69b41ac87e4a664de78a395ff97166f0b2943210
patch link: https://lore.kernel.org/r/20220920-resend-v4l2-compliance-v3-8-598d33a15815%40chromium.org
patch subject: [PATCH v3 8/8] media: uvcvideo: Use standard names for menus
config: arm-randconfig-m041-20230101
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
smatch warnings:
drivers/media/usb/uvc/uvc_ctrl.c:1395 uvc_query_v4l2_menu() warn: unsigned 'menu_value' is never less than zero.
vim +/menu_value +1395 drivers/media/usb/uvc/uvc_ctrl.c
1345
1346 /*
1347 * Mapping V4L2 controls to UVC controls can be straightforward if done well.
1348 * Most of the UVC controls exist in V4L2, and can be mapped directly. Some
1349 * must be grouped (for instance the Red Balance, Blue Balance and Do White
1350 * Balance V4L2 controls use the White Balance Component UVC control) or
1351 * otherwise translated. The approach we take here is to use a translation
1352 * table for the controls that can be mapped directly, and handle the others
1353 * manually.
1354 */
1355 int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
1356 struct v4l2_querymenu *query_menu)
1357 {
1358 struct uvc_control_mapping *mapping;
1359 struct uvc_control *ctrl;
1360 u32 index = query_menu->index;
1361 u32 id = query_menu->id;
1362 const char *name;
1363 int ret;
1364
1365 memset(query_menu, 0, sizeof(*query_menu));
1366 query_menu->id = id;
1367 query_menu->index = index;
1368
1369 ret = mutex_lock_interruptible(&chain->ctrl_mutex);
1370 if (ret < 0)
1371 return -ERESTARTSYS;
1372
1373 ctrl = uvc_find_control(chain, query_menu->id, &mapping);
1374 if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) {
1375 ret = -EINVAL;
1376 goto done;
1377 }
1378
1379 if (!test_bit(query_menu->index, &mapping->menu_mask)) {
1380 ret = -EINVAL;
1381 goto done;
1382 }
1383
1384 if (mapping->data_type == UVC_CTRL_DATA_TYPE_BITMASK) {
1385 u32 menu_value;
1386
1387 if (!ctrl->cached) {
1388 ret = uvc_ctrl_populate_cache(chain, ctrl);
1389 if (ret < 0)
1390 goto done;
1391 }
1392
1393 menu_value = uvc_mapping_get_menu_value(mapping,
1394 query_menu->index);
> 1395 if (menu_value < 0) {
1396 ret = menu_value;
1397 goto done;
1398 }
1399 if (!(uvc_get_ctrl_bitmap(ctrl, mapping) & menu_value)) {
1400 ret = -EINVAL;
1401 goto done;
1402 }
1403 }
1404
1405 name = uvc_mapping_get_menu_name(mapping, query_menu->index);
1406 if (!name) {
1407 ret = -EINVAL;
1408 goto done;
1409 }
1410
1411 strscpy(query_menu->name, name, sizeof(query_menu->name));
1412
1413 done:
1414 mutex_unlock(&chain->ctrl_mutex);
1415 return ret;
1416 }
1417
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (170976 bytes)
Powered by blists - more mailing lists