aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--block/snapshot.c6
-rw-r--r--docs/sphinx/qapidoc.py2
-rw-r--r--hw/virtio/virtio-mem.c22
-rw-r--r--meson.build1
-rw-r--r--scripts/qapi/schema.py3
-rwxr-xr-xtests/qapi-schema/test-qapi.py9
7 files changed, 23 insertions, 22 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 6999b26a0f..ff1238bb98 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2257,7 +2257,7 @@ M: Stefan Hajnoczi <stefanha@redhat.com>
S: Supported
F: hw/virtio/vhost-user-fs*
F: include/hw/virtio/vhost-user-fs.h
-L: virtio-fs@redhat.com
+L: virtio-fs@lists.linux.dev
virtio-input
M: Gerd Hoffmann <kraxel@redhat.com>
diff --git a/block/snapshot.c b/block/snapshot.c
index 6e16eb803a..55974273ae 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -629,7 +629,6 @@ int bdrv_all_goto_snapshot(const char *name,
while (iterbdrvs) {
BlockDriverState *bs = iterbdrvs->data;
AioContext *ctx = bdrv_get_aio_context(bs);
- int ret = 0;
bool all_snapshots_includes_bs;
aio_context_acquire(ctx);
@@ -637,9 +636,8 @@ int bdrv_all_goto_snapshot(const char *name,
all_snapshots_includes_bs = bdrv_all_snapshots_includes_bs(bs);
bdrv_graph_rdunlock_main_loop();
- if (devices || all_snapshots_includes_bs) {
- ret = bdrv_snapshot_goto(bs, name, errp);
- }
+ ret = (devices || all_snapshots_includes_bs) ?
+ bdrv_snapshot_goto(bs, name, errp) : 0;
aio_context_release(ctx);
if (ret < 0) {
bdrv_graph_rdlock_main_loop();
diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index 8f3b9997a1..658c288f8f 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -515,7 +515,7 @@ class QAPIDocDirective(Directive):
except QAPIError as err:
# Launder QAPI parse errors into Sphinx extension errors
# so they are displayed nicely to the user
- raise ExtensionError(str(err))
+ raise ExtensionError(str(err)) from err
def do_parse(self, rstlist, node):
"""Parse rST source lines and add them to the specified node
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
index a5ea3be414..75ee38aa46 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
@@ -525,9 +525,7 @@ static void virtio_mem_activate_memslots_to_plug(VirtIOMEM *vmem,
vmem->memslot_size;
unsigned int idx;
- if (!vmem->dynamic_memslots) {
- return;
- }
+ assert(vmem->dynamic_memslots);
/* Activate all involved memslots in a single transaction. */
memory_region_transaction_begin();
@@ -547,9 +545,7 @@ static void virtio_mem_deactivate_unplugged_memslots(VirtIOMEM *vmem,
vmem->memslot_size;
unsigned int idx;
- if (!vmem->dynamic_memslots) {
- return;
- }
+ assert(vmem->dynamic_memslots);
/* Deactivate all memslots with unplugged blocks in a single transaction. */
memory_region_transaction_begin();
@@ -598,7 +594,9 @@ static int virtio_mem_set_block_state(VirtIOMEM *vmem, uint64_t start_gpa,
virtio_mem_notify_unplug(vmem, offset, size);
virtio_mem_set_range_unplugged(vmem, start_gpa, size);
/* Deactivate completely unplugged memslots after updating the state. */
- virtio_mem_deactivate_unplugged_memslots(vmem, offset, size);
+ if (vmem->dynamic_memslots) {
+ virtio_mem_deactivate_unplugged_memslots(vmem, offset, size);
+ }
return 0;
}
@@ -635,9 +633,11 @@ static int virtio_mem_set_block_state(VirtIOMEM *vmem, uint64_t start_gpa,
* blocks we are plugging here. The following notification will inform
* registered listeners about the blocks we're plugging.
*/
- virtio_mem_activate_memslots_to_plug(vmem, offset, size);
+ if (vmem->dynamic_memslots) {
+ virtio_mem_activate_memslots_to_plug(vmem, offset, size);
+ }
ret = virtio_mem_notify_plug(vmem, offset, size);
- if (ret) {
+ if (ret && vmem->dynamic_memslots) {
virtio_mem_deactivate_unplugged_memslots(vmem, offset, size);
}
}
@@ -749,7 +749,9 @@ static int virtio_mem_unplug_all(VirtIOMEM *vmem)
notifier_list_notify(&vmem->size_change_notifiers, &vmem->size);
/* Deactivate all memslots after updating the state. */
- virtio_mem_deactivate_unplugged_memslots(vmem, 0, region_size);
+ if (vmem->dynamic_memslots) {
+ virtio_mem_deactivate_unplugged_memslots(vmem, 0, region_size);
+ }
}
trace_virtio_mem_unplugged_all();
diff --git a/meson.build b/meson.build
index d7d841e71e..ec01f8b138 100644
--- a/meson.build
+++ b/meson.build
@@ -462,6 +462,7 @@ warn_flags = [
'-Wno-tautological-type-limit-compare',
'-Wno-psabi',
'-Wno-gnu-variable-sized-type-not-at-end',
+ '-Wshadow=local',
]
if targetos != 'darwin'
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index d739e558e9..6a836950a9 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -76,7 +76,8 @@ class QAPISchemaEntity:
def __repr__(self):
if self.name is None:
return "<%s at 0x%x>" % (type(self).__name__, id(self))
- return "<%s:%s at 0x%x>" % type(self).__name__, self.name, id(self)
+ return "<%s:%s at 0x%x>" % (type(self).__name__, self.name,
+ id(self))
def c_name(self):
return c_name(self.name)
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index d58c31f539..14f7b62a44 100755
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -136,12 +136,11 @@ def test_frontend(fname):
def open_test_result(dir_name, file_name, update):
mode = 'r+' if update else 'r'
try:
- fp = open(os.path.join(dir_name, file_name), mode)
+ return open(os.path.join(dir_name, file_name), mode, encoding='utf-8')
except FileNotFoundError:
if not update:
raise
- fp = open(os.path.join(dir_name, file_name), 'w+')
- return fp
+ return open(os.path.join(dir_name, file_name), 'w+', encoding='utf-8')
def test_and_diff(test_name, dir_name, update):
@@ -218,9 +217,9 @@ def main(argv):
test_name = os.path.splitext(base_name)[0]
status |= test_and_diff(test_name, dir_name, args.update)
- exit(status)
+ sys.exit(status)
if __name__ == '__main__':
main(sys.argv)
- exit(0)
+ sys.exit(0)