[PATCH] fixup! net: add virtio network driver
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Sep 16 02:33:56 PDT 2021
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 <a.fatoum at pengutronix.de>
---
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
More information about the barebox
mailing list