[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/21] net/virtio: Drop useless n->primary_dev not null checks
From: |
Markus Armbruster |
Subject: |
[PATCH 01/21] net/virtio: Drop useless n->primary_dev not null checks |
Date: |
Sat, 30 Nov 2019 20:42:20 +0100 |
virtio_net_handle_migration_primary() returns early when it can't
ensure n->primary_dev is non-null. Checking it again right after that
early return is redundant. Drop.
If n->primary_dev is null on entering failover_replug_primary(), @pdev
will become null, and pdev->partially_hotplugged will crash. Checking
n->primary_dev later is useless. It can't actually be null, because
its caller virtio_net_handle_migration_primary() ensures it isn't.
Drop the useless check.
Cc: Jens Freimann <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
hw/net/virtio-net.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3c31471026..87088ba374 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2810,11 +2810,6 @@ static bool failover_replug_primary(VirtIONet *n, Error
**errp)
goto out;
}
}
- if (!n->primary_dev) {
- error_setg(errp, "virtio_net: couldn't find primary device");
- goto out;
- }
-
n->primary_bus = n->primary_dev->parent_bus;
if (!n->primary_bus) {
error_setg(errp, "virtio_net: couldn't find primary bus");
@@ -2849,8 +2844,7 @@ static void virtio_net_handle_migration_primary(VirtIONet
*n,
}
}
- if (migration_in_setup(s) && !should_be_hidden &&
- n->primary_dev) {
+ if (migration_in_setup(s) && !should_be_hidden) {
if (failover_unplug_primary(n)) {
vmstate_unregister(n->primary_dev, qdev_get_vmsd(n->primary_dev),
n->primary_dev);
--
2.21.0
- [PATCH 00/21] Error handling fixes, may contain 4.2 material, Markus Armbruster, 2019/11/30
- [PATCH 04/21] crypto: Fix certificate file error handling crash bug, Markus Armbruster, 2019/11/30
- [PATCH 03/21] block/file-posix: Fix laio_init() error handling crash bug, Markus Armbruster, 2019/11/30
- [PATCH 02/21] net/virtio: Fix failover error handling crash bugs, Markus Armbruster, 2019/11/30
- [PATCH 05/21] crypto: Fix typo in QCryptoTLSSession's <example> comment, Markus Armbruster, 2019/11/30
- [PATCH 01/21] net/virtio: Drop useless n->primary_dev not null checks,
Markus Armbruster <=
- [PATCH 19/21] error: Clean up unusual names of Error * variables, Markus Armbruster, 2019/11/30
- [PATCH 08/21] exec: Fix latent file_ram_alloc() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 06/21] io: Fix Error usage in a comment <example>, Markus Armbruster, 2019/11/30
- [PATCH 16/21] s390/cpu_modules: Fix latent realize() error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 14/21] s390x/event-facility: Fix latent realize() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 10/21] hw/core: Fix latent fit_load_fdt() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 07/21] tests: Clean up initialization of Error *err variables, Markus Armbruster, 2019/11/30
- [PATCH 15/21] s390x/cpu_models: Fix latent feature property error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 13/21] memory-device: Fix latent memory pre-plug error handling bugs, Markus Armbruster, 2019/11/30