We already stop the virtio device. Let's clean up the rest too and
unregister the network interface and free the private data.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 drivers/net/virtio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/virtio.c b/drivers/net/virtio.c
index 275588e15c50..ea4d5529037e 100644
--- a/drivers/net/virtio.c
+++ b/drivers/net/virtio.c
@@ -171,6 +171,8 @@ static int virtio_net_probe(struct virtio_device *vdev)
 
        priv = xzalloc(sizeof(*priv));
 
+       vdev->priv = priv;
+
        /*
         * For v1.0 compliant device, it always assumes the member
         * 'num_buffers' exists in the struct virtio_net_hdr while
@@ -205,8 +207,13 @@ static int virtio_net_probe(struct virtio_device *vdev)
 
 static void virtio_net_remove(struct virtio_device *vdev)
 {
+       struct virtio_net_priv *priv = vdev->priv;
+
        vdev->config->reset(vdev);
+       eth_unregister(&priv->edev);
        vdev->config->del_vqs(vdev);
+
+       free(priv);
 }
 
 /*
-- 
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to