From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jens Freimann <jfreimann@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: [PULL for-4.2 1/3] net/virtio: Drop useless n->primary_dev not null checks
Date: Mon, 2 Dec 2019 16:27:44 +0100 [thread overview]
Message-ID: <20191202152746.32292-2-armbru@redhat.com> (raw)
In-Reply-To: <20191202152746.32292-1-armbru@redhat.com>
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 <jfreimann@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191130194240.10517-2-armbru@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
---
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
next prev parent reply other threads:[~2019-12-02 15:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-02 15:27 [PULL for-4.2 0/3] Error reporting patches for 2019-12-02 Markus Armbruster
2019-12-02 15:27 ` Markus Armbruster [this message]
2019-12-02 15:27 ` [PULL for-4.2 2/3] net/virtio: Fix failover error handling crash bugs Markus Armbruster
2019-12-02 15:27 ` [PULL for-4.2 3/3] block/file-posix: Fix laio_init() error handling crash bug Markus Armbruster
2019-12-02 17:09 ` [PULL for-4.2 0/3] Error reporting patches for 2019-12-02 Peter Maydell
2019-12-02 18:22 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191202152746.32292-2-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=jfreimann@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).