[PATCH 13/13] virtio: Free mmio base when removing sandbox virtio emul

Simon Glass sjg at chromium.org
Wed May 27 18:10:23 CEST 2026


sandbox_emul_of_to_plat() uses memalign() for its emulated MMIO region,
but sandbox_emul_remove() only unregisters the MMIO callback; the buffer
itself (several KB per device) is not freed.

Free it on removal.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/virtio/sandbox_emul.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/virtio/sandbox_emul.c b/drivers/virtio/sandbox_emul.c
index 673575806ac..ea7e72b4dc6 100644
--- a/drivers/virtio/sandbox_emul.c
+++ b/drivers/virtio/sandbox_emul.c
@@ -295,7 +295,10 @@ static int sandbox_emul_of_to_plat(struct udevice *dev)
 
 static int sandbox_emul_remove(struct udevice *dev)
 {
+	struct sandbox_emul_priv *priv = dev_get_priv(dev);
+
 	sandbox_mmio_remove(dev);
+	free(priv->mmio.base);
 
 	return 0;
 }
-- 
2.43.0



More information about the U-Boot mailing list