[tiwai-sound:for-next 25/29] sound/usb/qcom/qc_audio_offload.c:1046:13: warning: unused variable 'mult'

kernel test robot <[email protected]>
Newsgroups org.alsa-project.alsa-devel,dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   64917f839d373df2573eb47f271df98f1daef7fa
commit: f1f16e1809c8f9e4a3c39f165efe114e0e292d8e [25/29] ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20260604/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260604/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   sound/usb/qcom/qc_audio_offload.c: In function 'uaudio_transfer_buffer_setup':
>> sound/usb/qcom/qc_audio_offload.c:1046:13: warning: unused variable 'mult' [-Wunused-variable]
    1046 |         u32 mult;
         |             ^~~~
>> sound/usb/qcom/qc_audio_offload.c:1045:13: warning: unused variable 'remainder' [-Wunused-variable]
    1045 |         u32 remainder;
         |             ^~~~~~~~~


vim +/mult +1046 sound/usb/qcom/qc_audio_offload.c

326bbc348298ab0 Wesley Cheng   2025-04-09  1022  
326bbc348298ab0 Wesley Cheng   2025-04-09  1023  /**
326bbc348298ab0 Wesley Cheng   2025-04-09  1024   * uaudio_transfer_buffer_setup() - fetch and populate xfer buffer params
326bbc348298ab0 Wesley Cheng   2025-04-09  1025   * @subs: usb substream
1d6452a0ce78cd3 Takashi Iwai   2026-02-26  1026   * @xfer_buf_cpu: xfer buf to be allocated
326bbc348298ab0 Wesley Cheng   2025-04-09  1027   * @xfer_buf_len: size of allocation
326bbc348298ab0 Wesley Cheng   2025-04-09  1028   * @mem_info: QMI response info
326bbc348298ab0 Wesley Cheng   2025-04-09  1029   *
326bbc348298ab0 Wesley Cheng   2025-04-09  1030   * Allocates and maps the transfer buffers that will be utilized by the
326bbc348298ab0 Wesley Cheng   2025-04-09  1031   * audio DSP.  Will populate the information in the QMI response that is
326bbc348298ab0 Wesley Cheng   2025-04-09  1032   * sent back to the stream enable request.
326bbc348298ab0 Wesley Cheng   2025-04-09  1033   *
326bbc348298ab0 Wesley Cheng   2025-04-09  1034   */
326bbc348298ab0 Wesley Cheng   2025-04-09  1035  static int uaudio_transfer_buffer_setup(struct snd_usb_substream *subs,
5c7ef5001292d70 Arnd Bergmann  2025-05-13  1036  					void **xfer_buf_cpu, u32 xfer_buf_len,
326bbc348298ab0 Wesley Cheng   2025-04-09  1037  					struct mem_info_v01 *mem_info)
326bbc348298ab0 Wesley Cheng   2025-04-09  1038  {
326bbc348298ab0 Wesley Cheng   2025-04-09  1039  	struct sg_table xfer_buf_sgt;
3335a1bbd62417f Arnd Bergmann  2025-05-13  1040  	dma_addr_t xfer_buf_dma;
5c7ef5001292d70 Arnd Bergmann  2025-05-13  1041  	void *xfer_buf;
326bbc348298ab0 Wesley Cheng   2025-04-09  1042  	u32 len = xfer_buf_len;
326bbc348298ab0 Wesley Cheng   2025-04-09  1043  	bool dma_coherent;
3335a1bbd62417f Arnd Bergmann  2025-05-13  1044  	dma_addr_t xfer_buf_dma_sysdev;
326bbc348298ab0 Wesley Cheng   2025-04-09 @1045  	u32 remainder;
326bbc348298ab0 Wesley Cheng   2025-04-09 @1046  	u32 mult;
326bbc348298ab0 Wesley Cheng   2025-04-09  1047  	int ret;
326bbc348298ab0 Wesley Cheng   2025-04-09  1048  
326bbc348298ab0 Wesley Cheng   2025-04-09  1049  	dma_coherent = dev_is_dma_coherent(subs->dev->bus->sysdev);
326bbc348298ab0 Wesley Cheng   2025-04-09  1050  
326bbc348298ab0 Wesley Cheng   2025-04-09  1051  	/* xfer buffer, multiple of 4K only */
326bbc348298ab0 Wesley Cheng   2025-04-09  1052  	if (!len)
326bbc348298ab0 Wesley Cheng   2025-04-09  1053  		len = PAGE_SIZE;
326bbc348298ab0 Wesley Cheng   2025-04-09  1054  
f1f16e1809c8f9e wangdicheng    2026-06-03  1055  	len = PAGE_ALIGN(len);
326bbc348298ab0 Wesley Cheng   2025-04-09  1056  
326bbc348298ab0 Wesley Cheng   2025-04-09  1057  	if (len > MAX_XFER_BUFF_LEN) {
326bbc348298ab0 Wesley Cheng   2025-04-09  1058  		dev_err(uaudio_qdev->data->dev,
326bbc348298ab0 Wesley Cheng   2025-04-09  1059  			"req buf len %d > max buf len %lu, setting %lu\n",
326bbc348298ab0 Wesley Cheng   2025-04-09  1060  			len, MAX_XFER_BUFF_LEN, MAX_XFER_BUFF_LEN);
326bbc348298ab0 Wesley Cheng   2025-04-09  1061  		len = MAX_XFER_BUFF_LEN;
326bbc348298ab0 Wesley Cheng   2025-04-09  1062  	}
326bbc348298ab0 Wesley Cheng   2025-04-09  1063  
3335a1bbd62417f Arnd Bergmann  2025-05-13  1064  	/* get buffer mapped into subs->dev */
3335a1bbd62417f Arnd Bergmann  2025-05-13  1065  	xfer_buf = usb_alloc_coherent(subs->dev, len, GFP_KERNEL, &xfer_buf_dma);
326bbc348298ab0 Wesley Cheng   2025-04-09  1066  	if (!xfer_buf)
326bbc348298ab0 Wesley Cheng   2025-04-09  1067  		return -ENOMEM;
326bbc348298ab0 Wesley Cheng   2025-04-09  1068  
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1069  	ret = dma_get_sgtable(subs->dev->bus->sysdev, &xfer_buf_sgt, xfer_buf,
3335a1bbd62417f Arnd Bergmann  2025-05-13  1070  			      xfer_buf_dma, len);
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1071  	if (ret)
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1072  		goto free_xfer_buf;
3335a1bbd62417f Arnd Bergmann  2025-05-13  1073  
3335a1bbd62417f Arnd Bergmann  2025-05-13  1074  	/* map the physical buffer into sysdev as well */
44499ecb4f28177 Takashi Iwai   2025-09-17  1075  	xfer_buf_dma_sysdev = uaudio_iommu_map_xfer_buf(dma_coherent,
44499ecb4f28177 Takashi Iwai   2025-09-17  1076  							len, &xfer_buf_sgt);
3335a1bbd62417f Arnd Bergmann  2025-05-13  1077  	if (!xfer_buf_dma_sysdev) {
326bbc348298ab0 Wesley Cheng   2025-04-09  1078  		ret = -ENOMEM;
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1079  		goto free_sgt;
326bbc348298ab0 Wesley Cheng   2025-04-09  1080  	}
326bbc348298ab0 Wesley Cheng   2025-04-09  1081  
3335a1bbd62417f Arnd Bergmann  2025-05-13  1082  	mem_info->dma = xfer_buf_dma;
326bbc348298ab0 Wesley Cheng   2025-04-09  1083  	mem_info->size = len;
3335a1bbd62417f Arnd Bergmann  2025-05-13  1084  	mem_info->iova = PREPEND_SID_TO_IOVA(xfer_buf_dma_sysdev, uaudio_qdev->data->sid);
5c7ef5001292d70 Arnd Bergmann  2025-05-13  1085  	*xfer_buf_cpu = xfer_buf;
326bbc348298ab0 Wesley Cheng   2025-04-09  1086  	sg_free_table(&xfer_buf_sgt);
326bbc348298ab0 Wesley Cheng   2025-04-09  1087  
326bbc348298ab0 Wesley Cheng   2025-04-09  1088  	return 0;
326bbc348298ab0 Wesley Cheng   2025-04-09  1089  
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1090  free_sgt:
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1091  	sg_free_table(&xfer_buf_sgt);
814b2c9b30e5607 Cássio Gabriel 2026-05-11  1092  free_xfer_buf:
3335a1bbd62417f Arnd Bergmann  2025-05-13  1093  	usb_free_coherent(subs->dev, len, xfer_buf, xfer_buf_dma);
326bbc348298ab0 Wesley Cheng   2025-04-09  1094  
326bbc348298ab0 Wesley Cheng   2025-04-09  1095  	return ret;
326bbc348298ab0 Wesley Cheng   2025-04-09  1096  }
326bbc348298ab0 Wesley Cheng   2025-04-09  1097  

:::::: The code at line 1046 was first introduced by commit
:::::: 326bbc348298ab0946c5560defe024a5f6ef28bb ALSA: usb-audio: qcom: Introduce QC USB SND offloading support

:::::: TO: Wesley Cheng <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.