Re: [PATCH v2 2/3] ALSA: hda/tas2781: Main code of tas2781 driver for SPI

From: kernel test robot
Date: Tue Apr 09 2024 - 13:01:11 EST


Hi Baojun,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on tiwai-sound/for-linus rafael-pm/linux-next linus/master v6.9-rc3 next-20240409]
[cannot apply to rafael-pm/acpi-bus rafael-pm/devprop]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Baojun-Xu/ALSA-hda-tas2781-Modification-for-add-tas2781-driver-for-SPI/20240409-105140
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20240409024816.1180-3-baojun.xu%40ti.com
patch subject: [PATCH v2 2/3] ALSA: hda/tas2781: Main code of tas2781 driver for SPI
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20240410/202404100015.FAgrEOeO-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 8b3b4a92adee40483c27f26c478a384cd69c6f05)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240410/202404100015.FAgrEOeO-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404100015.FAgrEOeO-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from sound/pci/hda/tas2781_hda_spi.c:9:
In file included from include/linux/acpi.h:39:
In file included from include/acpi/acpi_io.h:7:
In file included from arch/arm64/include/asm/acpi.h:14:
In file included from include/linux/memblock.h:12:
In file included from include/linux/mm.h:2208:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> sound/pci/hda/tas2781_hda_spi.c:1159:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
1159 | if (strstr(dev_name(&spi->dev), "TIAS2781")) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/hda/tas2781_hda_spi.c:1203:6: note: uninitialized use occurs here
1203 | if (ret)
| ^~~
sound/pci/hda/tas2781_hda_spi.c:1159:2: note: remove the 'if' if its condition is always true
1159 | if (strstr(dev_name(&spi->dev), "TIAS2781")) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1160 | device_name = "TIAS2781";
1161 | tas_priv->save_calibration = tas2781_save_calibration;
1162 | tas_priv->apply_calibration = tas2781_apply_calib;
1163 | } else
| ~~~~
1164 | goto err;
| ~~~~~~~~
>> sound/pci/hda/tas2781_hda_spi.c:1153:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
1153 | if (!tas_priv)
| ^~~~~~~~~
sound/pci/hda/tas2781_hda_spi.c:1203:6: note: uninitialized use occurs here
1203 | if (ret)
| ^~~
sound/pci/hda/tas2781_hda_spi.c:1153:2: note: remove the 'if' if its condition is always false
1153 | if (!tas_priv)
| ^~~~~~~~~~~~~~
1154 | goto err;
| ~~~~~~~~
sound/pci/hda/tas2781_hda_spi.c:1144:9: note: initialize the variable 'ret' to silence this warning
1144 | int ret;
| ^
| = 0
7 warnings generated.


vim +1159 sound/pci/hda/tas2781_hda_spi.c

1138
1139 static int tas2781_hda_spi_probe(struct spi_device *spi)
1140 {
1141 struct tasdevice_priv *tas_priv;
1142 struct tas2781_hda *tas_hda;
1143 const char *device_name;
1144 int ret;
1145
1146 tas_hda = devm_kzalloc(&spi->dev, sizeof(*tas_hda), GFP_KERNEL);
1147 if (!tas_hda)
1148 return -ENOMEM;
1149
1150 tas_hda->dev = &spi->dev;
1151
1152 tas_priv = devm_kzalloc(&spi->dev, sizeof(*tas_priv), GFP_KERNEL);
> 1153 if (!tas_priv)
1154 goto err;
1155 tas_priv->dev = &spi->dev;
1156 tas_priv->client = (void *)spi;
1157 tas_hda->priv = tas_priv;
1158
> 1159 if (strstr(dev_name(&spi->dev), "TIAS2781")) {
1160 device_name = "TIAS2781";
1161 tas_priv->save_calibration = tas2781_save_calibration;
1162 tas_priv->apply_calibration = tas2781_apply_calib;
1163 } else
1164 goto err;
1165
1166 tas_priv->irq_info.irq = spi->irq;
1167 dev_set_drvdata(&spi->dev, tas_hda);
1168 ret = tas2781_read_acpi(tas_hda, device_name,
1169 spi_get_chipselect(spi, 0));
1170 if (ret)
1171 return dev_err_probe(tas_hda->dev, ret,
1172 "Platform not supported\n");
1173
1174 tas_priv->regmap = devm_regmap_init_spi(spi, &tasdevice_regmap);
1175 if (IS_ERR(tas_priv->regmap)) {
1176 ret = PTR_ERR(tas_priv->regmap);
1177 dev_err(tas_priv->dev, "Failed to allocate regmap: %d\n",
1178 ret);
1179 goto err;
1180 }
1181 ret = tasdevice_spi_init(tas_hda->priv);
1182 if (ret)
1183 goto err;
1184
1185 pm_runtime_set_autosuspend_delay(tas_hda->dev, 3000);
1186 pm_runtime_use_autosuspend(tas_hda->dev);
1187 pm_runtime_mark_last_busy(tas_hda->dev);
1188 pm_runtime_set_active(tas_hda->dev);
1189 pm_runtime_get_noresume(tas_hda->dev);
1190 pm_runtime_enable(tas_hda->dev);
1191
1192 pm_runtime_put_autosuspend(tas_hda->dev);
1193
1194 tas2781_spi_reset(tas_priv);
1195
1196 ret = component_add(tas_hda->dev, &tas2781_hda_comp_ops);
1197 if (ret) {
1198 dev_err(tas_hda->dev, "Register component failed: %d\n", ret);
1199 pm_runtime_disable(tas_hda->dev);
1200 }
1201
1202 err:
1203 if (ret)
1204 tas2781_hda_remove(&spi->dev);
1205 return ret;
1206 }
1207

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki