@samitouri / QOSamiQemu / commits / a252e830ab

cocci: Do not initialize variable used by QSLIST_FOREACH macro

The QSLIST_FOREACH() macro, defined in "qemu/queue.h", always assigns its iterator variable when entering the loop. Remove the pointless and possibly misleading assignment. Mechanical patch using the following coccinelle spatch: @@ type T; identifier e; iterator FOREACH_MACRO =~ ".*_FOREACH.*"; statement S; @@ - T *e = ...; + T *e; ... when != e FOREACH_MACRO(e, ...) S Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Message-Id: <20260415215539.92629-3-philmd@linaro.org>

Philippe Mathieu-Daudé committed Apr 15, 2026 at 23:05 UTC a252e830ab7b11d4e5aa8247c6835ac1b8d7fd3a
1 file changed +1 -1
ebpf/ebpf.c
+1 -1
@@ -40,7 +40,7 @@ void ebpf_register_binary_data(int id, const void *data, size_t datalen)
40
41 const void *ebpf_find_binary_by_id(int id, size_t *sz, Error **errp)
42 {
43 - struct ElfBinaryDataEntry *it = NULL;
43 + struct ElfBinaryDataEntry *it;
44 QSLIST_FOREACH(it, &ebpf_elf_obj_list, node) {
45 if (id == it->id) {
46 *sz = it->datalen;