sound/core/control.c:1317:50: sparse: sparse: restricted snd_ctl_elem_iface_t degrades to integer

From: kernel test robot

Date: Thu Jun 11 2026 - 18:27:23 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9716c086c8e8b141d35aa61f2e96a2e83de212a7
commit: 0542972950ef26670a5696e43c0ea2b7b6ac96d4 Merge branch 'for-linus' into for-next
date: 2 months ago
config: arm-randconfig-r132-20260611 (https://download.01.org/0day-ci/archive/20260612/202606120654.suk2F79G-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project e95871719c41a8de96b438b962ed3b8f869b9e0c)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260612/202606120654.suk2F79G-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
| Fixes: 0542972950ef ("Merge branch 'for-linus' into for-next")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606120654.suk2F79G-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
sound/core/control.c:396:11: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long h @@ got restricted snd_ctl_elem_iface_t const [usertype] iface @@
sound/core/control.c:396:11: sparse: expected unsigned long h
sound/core/control.c:396:11: sparse: got restricted snd_ctl_elem_iface_t const [usertype] iface
sound/core/control.c:959:17: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
sound/core/control.c:959:26: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
sound/core/control.c:960:17: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
sound/core/control.c:960:26: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
sound/core/control.c:979:48: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
sound/core/control.c:1007:41: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
sound/core/control.c:1118:34: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
>> sound/core/control.c:1317:50: sparse: sparse: restricted snd_ctl_elem_iface_t degrades to integer
sound/core/control.c:1745:40: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer

vim +1317 sound/core/control.c

84446536f63d47 Cezary Rojewski 2026-02-24 1285
84446536f63d47 Cezary Rojewski 2026-02-24 1286 static int snd_ctl_put_verify(struct snd_card *card, struct snd_kcontrol *kctl,
84446536f63d47 Cezary Rojewski 2026-02-24 1287 struct snd_ctl_elem_value *control)
84446536f63d47 Cezary Rojewski 2026-02-24 1288 {
84446536f63d47 Cezary Rojewski 2026-02-24 1289 struct snd_ctl_elem_value *original = card->value_buf;
84446536f63d47 Cezary Rojewski 2026-02-24 1290 struct snd_ctl_elem_info info;
84446536f63d47 Cezary Rojewski 2026-02-24 1291 const char *iname;
84446536f63d47 Cezary Rojewski 2026-02-24 1292 int ret, retcmp;
84446536f63d47 Cezary Rojewski 2026-02-24 1293
84446536f63d47 Cezary Rojewski 2026-02-24 1294 memset(original, 0, sizeof(*original));
84446536f63d47 Cezary Rojewski 2026-02-24 1295 memset(&info, 0, sizeof(info));
84446536f63d47 Cezary Rojewski 2026-02-24 1296
84446536f63d47 Cezary Rojewski 2026-02-24 1297 ret = kctl->info(kctl, &info);
84446536f63d47 Cezary Rojewski 2026-02-24 1298 if (ret)
84446536f63d47 Cezary Rojewski 2026-02-24 1299 return ret;
84446536f63d47 Cezary Rojewski 2026-02-24 1300
84446536f63d47 Cezary Rojewski 2026-02-24 1301 ret = kctl->get(kctl, original);
84446536f63d47 Cezary Rojewski 2026-02-24 1302 if (ret)
84446536f63d47 Cezary Rojewski 2026-02-24 1303 return ret;
84446536f63d47 Cezary Rojewski 2026-02-24 1304
84446536f63d47 Cezary Rojewski 2026-02-24 1305 ret = kctl->put(kctl, control);
84446536f63d47 Cezary Rojewski 2026-02-24 1306 if (ret < 0)
84446536f63d47 Cezary Rojewski 2026-02-24 1307 return ret;
84446536f63d47 Cezary Rojewski 2026-02-24 1308
84446536f63d47 Cezary Rojewski 2026-02-24 1309 /* Sanitize the new value (control->value) before comparing. */
84446536f63d47 Cezary Rojewski 2026-02-24 1310 fill_remaining_elem_value(control, &info, 0);
84446536f63d47 Cezary Rojewski 2026-02-24 1311
84446536f63d47 Cezary Rojewski 2026-02-24 1312 /* With known state for both new and original, do the comparison. */
84446536f63d47 Cezary Rojewski 2026-02-24 1313 retcmp = memcmp(&original->value, &control->value, sizeof(original->value));
84446536f63d47 Cezary Rojewski 2026-02-24 1314 if (retcmp)
84446536f63d47 Cezary Rojewski 2026-02-24 1315 retcmp = 1;
84446536f63d47 Cezary Rojewski 2026-02-24 1316
84446536f63d47 Cezary Rojewski 2026-02-24 @1317 iname = snd_ctl_elem_iface_names[kctl->id.iface];
84446536f63d47 Cezary Rojewski 2026-02-24 1318 trace_snd_ctl_put(&kctl->id, iname, card->number, ret, retcmp);
84446536f63d47 Cezary Rojewski 2026-02-24 1319
84446536f63d47 Cezary Rojewski 2026-02-24 1320 return ret;
84446536f63d47 Cezary Rojewski 2026-02-24 1321 }
84446536f63d47 Cezary Rojewski 2026-02-24 1322

:::::: The code at line 1317 was first introduced by commit
:::::: 84446536f63d471ab16b2faa25eeab1df21ace0a ALSA: control: Verify put() result when in debug mode

:::::: TO: Cezary Rojewski <cezary.rojewski@xxxxxxxxx>
:::::: CC: Takashi Iwai <tiwai@xxxxxxx>

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