Commit 122a3dd50a for qemu.org
commit 122a3dd50a75c729c408f4706b0b7517b02b8215
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
Date: Wed Apr 15 23:07:09 2026 +0200
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>
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 8a4a8cb85e..fdc96d1f45 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -591,7 +591,7 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, BlkdebugIOType iotype)
{
BDRVBlkdebugState *s = bs->opaque;
- BlkdebugRule *rule = NULL;
+ BlkdebugRule *rule;
int error;
bool immediately;
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index a061aad817..87009c4518 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -1216,7 +1216,7 @@ fail:
static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque, Error **errp)
{
DBMSaveState *s = &((DBMState *)opaque)->save;
- SaveBitmapState *dbms = NULL;
+ SaveBitmapState *dbms;
if (init_dirty_bitmap_migration(s, errp) < 0) {
return -1;