virtio-mem: silence a static checker warning
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 10 Jun 2020 08:59:11 +0000 (11:59 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 22 Jun 2020 16:34:21 +0000 (12:34 -0400)
Smatch complains that "rc" can be uninitialized if we hit the "break;"
statement on the first iteration through the loop.  I suspect that this
can't happen in real life, but returning a zero literal is cleaner and
silence the static checker warning.

Fixes: 5f1f79bbc9e2 ("virtio-mem: Paravirtualized memory hotplug")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200610085911.GC5439@mwanda
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_mem.c

index 50c689f..5210ff0 100644 (file)
@@ -1192,7 +1192,7 @@ static int virtio_mem_mb_plug_any_sb(struct virtio_mem *vm, unsigned long mb_id,
                                                VIRTIO_MEM_MB_STATE_OFFLINE);
        }
 
-       return rc;
+       return 0;
 }
 
 /*