From: Chen Gang <gang.chen.5i5j@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>,
QEMU Trivial <qemu-trivial@nongnu.org>
Subject: [Qemu-trivial] [PATCH] hw/net/xen_nic.c: Need free 'netdev->nic' in net_free() instead of net_disconnect()
Date: Wed, 17 Dec 2014 04:52:16 +0800 [thread overview]
Message-ID: <54909B80.4030602@gmail.com> (raw)
net_init() and net_free() are pairs, net_connect() and net_disconnect()
are pairs. net_init() creates 'netdev->nic', so also need free it in
net_free().
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
hw/net/xen_nic.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c
index 7a57feb..8eaa77b 100644
--- a/hw/net/xen_nic.c
+++ b/hw/net/xen_nic.c
@@ -410,10 +410,6 @@ static void net_disconnect(struct XenDevice *xendev)
xc_gnttab_munmap(netdev->xendev.gnttabdev, netdev->rxs, 1);
netdev->rxs = NULL;
}
- if (netdev->nic) {
- qemu_del_nic(netdev->nic);
- netdev->nic = NULL;
- }
}
static void net_event(struct XenDevice *xendev)
@@ -427,6 +423,10 @@ static int net_free(struct XenDevice *xendev)
{
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
+ if (netdev->nic) {
+ qemu_del_nic(netdev->nic);
+ netdev->nic = NULL;
+ }
g_free(netdev->mac);
return 0;
}
--
1.9.3
WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>,
QEMU Trivial <qemu-trivial@nongnu.org>
Subject: [Qemu-devel] [PATCH] hw/net/xen_nic.c: Need free 'netdev->nic' in net_free() instead of net_disconnect()
Date: Wed, 17 Dec 2014 04:52:16 +0800 [thread overview]
Message-ID: <54909B80.4030602@gmail.com> (raw)
net_init() and net_free() are pairs, net_connect() and net_disconnect()
are pairs. net_init() creates 'netdev->nic', so also need free it in
net_free().
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
hw/net/xen_nic.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c
index 7a57feb..8eaa77b 100644
--- a/hw/net/xen_nic.c
+++ b/hw/net/xen_nic.c
@@ -410,10 +410,6 @@ static void net_disconnect(struct XenDevice *xendev)
xc_gnttab_munmap(netdev->xendev.gnttabdev, netdev->rxs, 1);
netdev->rxs = NULL;
}
- if (netdev->nic) {
- qemu_del_nic(netdev->nic);
- netdev->nic = NULL;
- }
}
static void net_event(struct XenDevice *xendev)
@@ -427,6 +423,10 @@ static int net_free(struct XenDevice *xendev)
{
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
+ if (netdev->nic) {
+ qemu_del_nic(netdev->nic);
+ netdev->nic = NULL;
+ }
g_free(netdev->mac);
return 0;
}
--
1.9.3
next reply other threads:[~2014-12-16 20:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 20:52 Chen Gang [this message]
2014-12-16 20:52 ` [Qemu-devel] [PATCH] hw/net/xen_nic.c: Need free 'netdev->nic' in net_free() instead of net_disconnect() Chen Gang
2015-01-07 16:01 ` [Qemu-trivial] " Stefan Hajnoczi
2015-01-07 16:01 ` Stefan Hajnoczi
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=54909B80.4030602@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.