Hi Pavel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on next-20220112]
[cannot apply to linus/master balbi-usb/testing/next peter-chen-usb/for-usb-next v5.16]
[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]
url:
https://github.com/0day-ci/linux/commits/Pavel-Hofman/usb-gadget-audio-Mu...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-randconfig-s001
(
https://download.01.org/0day-ci/archive/20220112/202201122317.eiQOLXzP-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
#
https://github.com/0day-ci/linux/commit/275344f5925d7804375e3572fd2fbd1fe...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Pavel-Hofman/usb-gadget-audio-Multiple-rates-notify/20220110-154453
git checkout 275344f5925d7804375e3572fd2fbd1febb029a6
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir
ARCH=i386 SHELL=/bin/bash drivers/usb/gadget/function/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> drivers/usb/gadget/function/f_uac2.c:1553:33: sparse: sparse:
restricted __le16 degrades to integer
> drivers/usb/gadget/function/f_uac2.c:1553:33: sparse: sparse: restricted __le16
degrades to integer
> drivers/usb/gadget/function/f_uac2.c:1553:33: sparse: sparse: restricted __le16
degrades to integer
> drivers/usb/gadget/function/f_uac2.c:1553:33: sparse: sparse: restricted __le16
degrades to integer
> drivers/usb/gadget/function/f_uac2.c:1553:33: sparse: sparse: restricted __le16
degrades to integer
> drivers/usb/gadget/function/f_uac2.c:1553:33: sparse: sparse: restricted __le16
degrades to integer
drivers/usb/gadget/function/f_uac2.c:1625:15: sparse: sparse:
cast to restricted __le32
vim +1553 drivers/usb/gadget/function/f_uac2.c
1511
1512 static int
1513 in_rq_range(struct usb_function *fn, const struct usb_ctrlrequest *cr)
1514 {
1515 struct usb_request *req = fn->config->cdev->req;
1516 struct g_audio *agdev = func_to_g_audio(fn);
1517 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev);
1518 u16 w_length = le16_to_cpu(cr->wLength);
1519 u16 w_index = le16_to_cpu(cr->wIndex);
1520 u16 w_value = le16_to_cpu(cr->wValue);
1521 u8 entity_id = (w_index >> 8) & 0xff;
1522 u8 control_selector = w_value >> 8;
1523 int value = -EOPNOTSUPP;
1524
1525 if ((entity_id == USB_IN_CLK_ID) || (entity_id == USB_OUT_CLK_ID)) {
1526 if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) {
1527 struct cntrl_ranges_lay3_srates rs;
1528 int i;
1529 int wNumSubRanges = 0;
1530 int srate;
1531 int *srates;
1532
1533 if (entity_id == USB_IN_CLK_ID)
1534 srates = opts->p_srates;
1535 else if (entity_id == USB_OUT_CLK_ID)
1536 srates = opts->c_srates;
1537 else
1538 return -EOPNOTSUPP;
1539 for (i = 0; i < UAC_MAX_RATES; i++) {
1540 srate = srates[i];
1541 if (srate == 0)
1542 break;
1543
1544 rs.r[wNumSubRanges].dMIN = cpu_to_le32(srate);
1545 rs.r[wNumSubRanges].dMAX = cpu_to_le32(srate);
1546 rs.r[wNumSubRanges].dRES = 0;
1547 wNumSubRanges++;
1548 dev_dbg(&agdev->gadget->dev,
1549 "%s(): clk %d: rate ID %d: %d\n",
1550 __func__, entity_id, wNumSubRanges, srate);
1551 }
1552 rs.wNumSubRanges = cpu_to_le16(wNumSubRanges);
1553 value = min_t(unsigned int, w_length, ranges_lay3_size(rs));
1554 dev_dbg(&agdev->gadget->dev, "%s(): sending %d rates, size
%d\n",
1555 __func__, rs.wNumSubRanges, value);
1556 memcpy(req->buf, &rs, value);
1557 } else {
1558 dev_err(&agdev->gadget->dev,
1559 "%s:%d control_selector=%d TODO!\n",
1560 __func__, __LINE__, control_selector);
1561 }
1562 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
1563 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
1564 unsigned int is_playback = 0;
1565
1566 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID))
1567 is_playback = 1;
1568
1569 if (control_selector == UAC_FU_VOLUME) {
1570 struct cntrl_range_lay2 r;
1571 s16 max_db, min_db, res_db;
1572
1573 if (is_playback) {
1574 max_db = opts->p_volume_max;
1575 min_db = opts->p_volume_min;
1576 res_db = opts->p_volume_res;
1577 } else {
1578 max_db = opts->c_volume_max;
1579 min_db = opts->c_volume_min;
1580 res_db = opts->c_volume_res;
1581 }
1582
1583 r.wMAX = cpu_to_le16(max_db);
1584 r.wMIN = cpu_to_le16(min_db);
1585 r.wRES = cpu_to_le16(res_db);
1586 r.wNumSubRanges = cpu_to_le16(1);
1587
1588 value = min_t(unsigned int, w_length, sizeof(r));
1589 memcpy(req->buf, &r, value);
1590 } else {
1591 dev_err(&agdev->gadget->dev,
1592 "%s:%d control_selector=%d TODO!\n",
1593 __func__, __LINE__, control_selector);
1594 }
1595 } else {
1596 dev_err(&agdev->gadget->dev,
1597 "%s:%d entity_id=%d control_selector=%d TODO!\n",
1598 __func__, __LINE__, entity_id, control_selector);
1599 }
1600
1601 return value;
1602 }
1603
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org