[linux-next:master 3909/4669] sound/hda/core/controller.c:726 snd_hdac_bus_alloc_stream_pages() warn: missing unwind goto?

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: Zhao Dongdong <[email protected]>
CC: Takashi Iwai <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b9810cd75b9fb56a3425d391cba3f608502bd474
commit: f16eaa38ea640884f66d24865c770c3f6c43bd42 [3909/4669] ALSA: hda/core: add cleanup in snd_hdac_bus_alloc_stream_pages()
:::::: branch date: 15 hours ago
:::::: commit date: 2 days ago
config: parisc-randconfig-r071-20260709 (https://download.01.org/0day-ci/archive/20260709/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 16.1.0
smatch: v0.5.0-9185-gbcc58b9c

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]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
sound/hda/core/controller.c:726 snd_hdac_bus_alloc_stream_pages() warn: missing unwind goto?

vim +726 sound/hda/core/controller.c

304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  701  
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  702  /**
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  703   * snd_hdac_bus_alloc_stream_pages - allocate BDL and other buffers
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  704   * @bus: HD-audio core bus
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  705   *
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  706   * Call this after assigning the all streams.
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  707   * Returns zero for success, or a negative error code.
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  708   */
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  709  int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus)
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  710  {
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  711  	struct hdac_stream *s;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  712  	int num_streams = 0;
619a1f195f9327 sound/hda/hdac_controller.c Takashi Iwai  2019-08-07  713  	int dma_type = bus->dma_type ? bus->dma_type : SNDRV_DMA_TYPE_DEV;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  714  	int err;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  715  
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  716  	list_for_each_entry(s, &bus->stream_list, list) {
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  717  		/* allocate memory for the BDL for each stream */
619a1f195f9327 sound/hda/hdac_controller.c Takashi Iwai  2019-08-07  718  		err = snd_dma_alloc_pages(dma_type, bus->dev,
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  719  					  BDL_SIZE, &s->bdl);
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  720  		num_streams++;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  721  		if (err < 0)
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  722  			goto error_bdl;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  723  	}
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  724  
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  725  	if (WARN_ON(!num_streams))
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12 @726  		return -EINVAL;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  727  	/* allocate memory for the position buffer */
619a1f195f9327 sound/hda/hdac_controller.c Takashi Iwai  2019-08-07  728  	err = snd_dma_alloc_pages(dma_type, bus->dev,
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  729  				  num_streams * 8, &bus->posbuf);
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  730  	if (err < 0)
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  731  		goto error_bdl;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  732  	list_for_each_entry(s, &bus->stream_list, list)
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  733  		s->posbuf = (__le32 *)(bus->posbuf.area + s->index * 8);
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  734  
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  735  	/* single page (at least 4096 bytes) must suffice for both ringbuffes */
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  736  	err = snd_dma_alloc_pages(dma_type, bus->dev, PAGE_SIZE, &bus->rb);
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  737  	if (err < 0)
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  738  		goto error_posbuf;
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  739  	return 0;
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  740  
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  741  error_posbuf:
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  742  	snd_dma_free_pages(&bus->posbuf);
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  743  error_bdl:
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  744  	list_for_each_entry(s, &bus->stream_list, list) {
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  745  		if (s->bdl.area)
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  746  			snd_dma_free_pages(&s->bdl);
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  747  	}
f16eaa38ea6408 sound/hda/core/controller.c Zhao Dongdong 2026-07-07  748  	return -ENOMEM;
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  749  }
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  750  EXPORT_SYMBOL_GPL(snd_hdac_bus_alloc_stream_pages);
304dad30388d01 sound/hda/hdac_controller.c Jeeja KP      2015-04-12  751  

:::::: The code at line 726 was first introduced by commit
:::::: 304dad30388d017544bc2e90fe4fefcca94263d3 ALSA: hda - moved alloc/free stream pages function to controller library

:::::: TO: Jeeja KP <[email protected]>
:::::: CC: Takashi Iwai <[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.