cocci: Do not initialize variable used by QSIMPLEQ_FOREACH macro
The QSIMPLEQ_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-4-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Apr 15, 2026 at 23:07 UTC
122a3dd50a75c729c408f4706b0b7517b02b8215
2 files changed
+2
-2
block/blkdebug.c
+1
-1
@@ -591,7 +591,7 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
591
uint64_t bytes, BlkdebugIOType iotype)
592
{
593
BDRVBlkdebugState *s = bs->opaque;
594
- BlkdebugRule *rule = NULL;
594
+ BlkdebugRule *rule;
595
int error;
596
bool immediately;
597
migration/block-dirty-bitmap.c
+1
-1
@@ -1216,7 +1216,7 @@ fail:
1216
static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque, Error **errp)
1217
{
1218
DBMSaveState *s = &((DBMState *)opaque)->save;
1219
- SaveBitmapState *dbms = NULL;
1219
+ SaveBitmapState *dbms;
1220
1221
if (init_dirty_bitmap_migration(s, errp) < 0) {
1222
return -1;