Commit 25f32223 authored by weiping zhang's avatar weiping zhang Committed by Michael S. Tsirkin

virtio_mmio: add cleanup for virtio_mmio_remove

cleanup all resource allocated by virtio_mmio_probe.
Signed-off-by: default avatarweiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
parent 7eb781b1
...@@ -610,7 +610,13 @@ static int virtio_mmio_probe(struct platform_device *pdev) ...@@ -610,7 +610,13 @@ static int virtio_mmio_probe(struct platform_device *pdev)
static int virtio_mmio_remove(struct platform_device *pdev) static int virtio_mmio_remove(struct platform_device *pdev)
{ {
struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev); struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
struct resource *mem;
iounmap(vm_dev->base);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (mem)
devm_release_mem_region(&pdev->dev, mem->start,
resource_size(mem));
unregister_virtio_device(&vm_dev->vdev); unregister_virtio_device(&vm_dev->vdev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment