Re: [PATCH v2 1/1] ALSA: control: Use list_for_each_entry_safe()

From: kernel test robot
Date: Tue Aug 29 2023 - 13:51:23 EST


Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus linus/master v6.5 next-20230829]
[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/Andy-Shevchenko/ALSA-control-Use-list_for_each_entry_safe/20230829-222521
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20230829142307.3916823-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v2 1/1] ALSA: control: Use list_for_each_entry_safe()
config: i386-buildonly-randconfig-001-20230829 (https://download.01.org/0day-ci/archive/20230830/202308300128.l96uIvcS-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230830/202308300128.l96uIvcS-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/202308300128.l96uIvcS-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> sound/core/control_led.c:304:3: error: assigning to 'struct snd_ctl_led_ctl' from incompatible type 'typeof (*(lctl)) *' (aka 'struct snd_ctl_led_ctl *'); dereference with *
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:777:5: note: expanded from macro 'list_for_each_entry_safe'
n = list_next_entry(pos, member); \
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/core/control_led.c:304:3: error: assigning to 'struct snd_ctl_led_ctl *' from incompatible type 'struct snd_ctl_led_ctl'; take the address with &
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^ ~~~~~
&
include/linux/list.h:779:11: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^ ~
>> sound/core/control_led.c:304:3: error: member reference type 'struct snd_ctl_led_ctl' is not a pointer; did you mean to use '.'?
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:18: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:520:15: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/container_of.h:19:26: note: expanded from macro 'container_of'
void *__mptr = (void *)(ptr); \
^~~
>> sound/core/control_led.c:304:3: error: member reference type 'struct snd_ctl_led_ctl' is not a pointer; did you mean to use '.'?
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:18: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:520:15: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:338:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~
>> sound/core/control_led.c:304:3: error: indirection requires pointer operand ('struct snd_ctl_led_ctl' invalid)
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:40: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
include/linux/list.h:520:20: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:338:74: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~
>> sound/core/control_led.c:304:3: error: member reference type 'struct snd_ctl_led_ctl' is not a pointer; did you mean to use '.'?
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:18: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:520:15: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:338:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~
>> sound/core/control_led.c:304:3: error: indirection requires pointer operand ('struct snd_ctl_led_ctl' invalid)
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:40: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
include/linux/list.h:520:20: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/container_of.h:23:4: note: expanded from macro 'container_of'
((type *)(__mptr - offsetof(type, member))); })
^~~~
>> sound/core/control_led.c:304:3: error: indirection requires pointer operand ('struct snd_ctl_led_ctl' invalid)
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:40: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
include/linux/list.h:520:20: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/container_of.h:23:30: note: expanded from macro 'container_of'
((type *)(__mptr - offsetof(type, member))); })
~~~~~~~~~^~~~~~~~~~~~~
include/linux/stddef.h:16:51: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
^~~~
>> sound/core/control_led.c:304:3: error: assigning to 'struct snd_ctl_led_ctl' from incompatible type 'void'
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:18: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/control_led.c:329:2: error: assigning to 'struct snd_ctl_led_ctl' from incompatible type 'typeof (*(lctl)) *' (aka 'struct snd_ctl_led_ctl *'); dereference with *
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:777:5: note: expanded from macro 'list_for_each_entry_safe'
n = list_next_entry(pos, member); \
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/control_led.c:329:2: error: assigning to 'struct snd_ctl_led_ctl *' from incompatible type 'struct snd_ctl_led_ctl'; take the address with &
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^ ~~~~~
&
include/linux/list.h:779:11: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^ ~
sound/core/control_led.c:329:2: error: member reference type 'struct snd_ctl_led_ctl' is not a pointer; did you mean to use '.'?
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:18: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:520:15: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/container_of.h:19:26: note: expanded from macro 'container_of'
void *__mptr = (void *)(ptr); \
^~~
sound/core/control_led.c:329:2: error: member reference type 'struct snd_ctl_led_ctl' is not a pointer; did you mean to use '.'?
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:18: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:520:15: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:338:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~
sound/core/control_led.c:329:2: error: indirection requires pointer operand ('struct snd_ctl_led_ctl' invalid)
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:40: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
include/linux/list.h:520:20: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:338:74: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~
sound/core/control_led.c:329:2: error: member reference type 'struct snd_ctl_led_ctl' is not a pointer; did you mean to use '.'?
list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:20: note: expanded from macro 'list_for_each_entry_safe'
pos = n, n = list_next_entry(n, member))
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:564:18: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:520:15: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:338:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~
sound/core/control_led.c:329:2: error: indirection requires pointer operand ('struct snd_ctl_led_ctl' invalid)


vim +304 sound/core/control_led.c

295
296 static void snd_ctl_led_clean(struct snd_card *card)
297 {
298 unsigned int group;
299 struct snd_ctl_led *led;
300 struct snd_ctl_led_ctl *lctl, _lctl;
301
302 for (group = 0; group < MAX_LED; group++) {
303 led = &snd_ctl_leds[group];
> 304 list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
305 if (!card || lctl->card == card)
306 snd_ctl_led_ctl_destroy(lctl);
307 }
308 }
309

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