sound/soc/intel/avs/boards/rt5640.c:151 avs_create_dai_link() warn: excess argument passed to 'devm_kasprintf'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Cezary Rojewski <[email protected]>
CC: Mark Brown <[email protected]>
CC: "Amadeusz Sławiński" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2f1baf1fc8929e6c48370be543ad028ac7ad4131
commit: c95e925daa434ee1a40a86aec6476ce588e4bd77 ASoC: Intel: avs: Add rt5640 machine board
date:   1 year, 2 months ago
:::::: branch date: 30 hours ago
:::::: commit date: 1 year, 2 months ago
config: i386-randconfig-r072-20260815 (https://download.01.org/0day-ci/archive/20260815/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

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
| Fixes: c95e925daa43 ("ASoC: Intel: avs: Add rt5640 machine board")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
sound/soc/intel/avs/boards/rt5640.c:151 avs_create_dai_link() warn: excess argument passed to 'devm_kasprintf'

Old smatch warnings:
sound/soc/intel/avs/boards/rt5640.c:158 avs_create_dai_link() warn: excess argument passed to 'devm_kasprintf'

vim +/devm_kasprintf +151 sound/soc/intel/avs/boards/rt5640.c

c95e925daa434e Cezary Rojewski 2025-05-30  129  
c95e925daa434e Cezary Rojewski 2025-05-30  130  static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot,
c95e925daa434e Cezary Rojewski 2025-05-30  131  			       struct snd_soc_acpi_mach *mach,
c95e925daa434e Cezary Rojewski 2025-05-30  132  			       struct snd_soc_dai_link **dai_link)
c95e925daa434e Cezary Rojewski 2025-05-30  133  {
c95e925daa434e Cezary Rojewski 2025-05-30  134  	struct snd_soc_dai_link_component *platform;
c95e925daa434e Cezary Rojewski 2025-05-30  135  	struct snd_soc_dai_link *dl;
c95e925daa434e Cezary Rojewski 2025-05-30  136  	u32 uid = 0;
c95e925daa434e Cezary Rojewski 2025-05-30  137  	int ret;
c95e925daa434e Cezary Rojewski 2025-05-30  138  
c95e925daa434e Cezary Rojewski 2025-05-30  139  	if (mach->uid) {
c95e925daa434e Cezary Rojewski 2025-05-30  140  		ret = kstrtou32(mach->uid, 0, &uid);
c95e925daa434e Cezary Rojewski 2025-05-30  141  		if (ret)
c95e925daa434e Cezary Rojewski 2025-05-30  142  			return ret;
c95e925daa434e Cezary Rojewski 2025-05-30  143  		uid--; /* 0-based indexing. */
c95e925daa434e Cezary Rojewski 2025-05-30  144  	}
c95e925daa434e Cezary Rojewski 2025-05-30  145  
c95e925daa434e Cezary Rojewski 2025-05-30  146  	dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL);
c95e925daa434e Cezary Rojewski 2025-05-30  147  	platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
c95e925daa434e Cezary Rojewski 2025-05-30  148  	if (!dl || !platform)
c95e925daa434e Cezary Rojewski 2025-05-30  149  		return -ENOMEM;
c95e925daa434e Cezary Rojewski 2025-05-30  150  
c95e925daa434e Cezary Rojewski 2025-05-30 @151  	dl->name = devm_kasprintf(dev, GFP_KERNEL,
c95e925daa434e Cezary Rojewski 2025-05-30  152  				  AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot));
c95e925daa434e Cezary Rojewski 2025-05-30  153  	dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
c95e925daa434e Cezary Rojewski 2025-05-30  154  	dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL);
c95e925daa434e Cezary Rojewski 2025-05-30  155  	if (!dl->name || !dl->cpus || !dl->codecs)
c95e925daa434e Cezary Rojewski 2025-05-30  156  		return -ENOMEM;
c95e925daa434e Cezary Rojewski 2025-05-30  157  
c95e925daa434e Cezary Rojewski 2025-05-30  158  	dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
c95e925daa434e Cezary Rojewski 2025-05-30  159  					    AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot));
c95e925daa434e Cezary Rojewski 2025-05-30  160  	dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5640:0%d", uid);
c95e925daa434e Cezary Rojewski 2025-05-30  161  	dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT5640_CODEC_DAI);
c95e925daa434e Cezary Rojewski 2025-05-30  162  	if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name)
c95e925daa434e Cezary Rojewski 2025-05-30  163  		return -ENOMEM;
c95e925daa434e Cezary Rojewski 2025-05-30  164  
c95e925daa434e Cezary Rojewski 2025-05-30  165  	platform->name = dev_name(dev);
c95e925daa434e Cezary Rojewski 2025-05-30  166  	dl->num_cpus = 1;
c95e925daa434e Cezary Rojewski 2025-05-30  167  	dl->num_codecs = 1;
c95e925daa434e Cezary Rojewski 2025-05-30  168  	dl->platforms = platform;
c95e925daa434e Cezary Rojewski 2025-05-30  169  	dl->num_platforms = 1;
c95e925daa434e Cezary Rojewski 2025-05-30  170  	dl->id = 0;
c95e925daa434e Cezary Rojewski 2025-05-30  171  	dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC;
c95e925daa434e Cezary Rojewski 2025-05-30  172  	dl->init = avs_rt5640_codec_init;
c95e925daa434e Cezary Rojewski 2025-05-30  173  	dl->exit = avs_rt5640_codec_exit;
c95e925daa434e Cezary Rojewski 2025-05-30  174  	dl->be_hw_params_fixup = avs_rt5640_be_fixup;
c95e925daa434e Cezary Rojewski 2025-05-30  175  	dl->ops = &avs_rt5640_ops;
c95e925daa434e Cezary Rojewski 2025-05-30  176  	dl->nonatomic = 1;
c95e925daa434e Cezary Rojewski 2025-05-30  177  	dl->no_pcm = 1;
c95e925daa434e Cezary Rojewski 2025-05-30  178  
c95e925daa434e Cezary Rojewski 2025-05-30  179  	*dai_link = dl;
c95e925daa434e Cezary Rojewski 2025-05-30  180  
c95e925daa434e Cezary Rojewski 2025-05-30  181  	return 0;
c95e925daa434e Cezary Rojewski 2025-05-30  182  }
c95e925daa434e Cezary Rojewski 2025-05-30  183  

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