]> git.baikalelectronics.ru Git - kernel.git/commitdiff
virtio_mmio: add cleanup for virtio_mmio_remove
authorweiping zhang <zhangweiping@didichuxing.com>
Wed, 6 Dec 2017 13:59:32 +0000 (21:59 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 7 Dec 2017 16:30:50 +0000 (18:30 +0200)
cleanup all resource allocated by virtio_mmio_probe.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
drivers/virtio/virtio_mmio.c

index ec401042a5d1a347ac9bda9c8809273fdb406ef2..a9192fe4f345e627e3f45010b4ecce434f1b04de 100644 (file)
@@ -610,7 +610,13 @@ free_vmdev:
 static int virtio_mmio_remove(struct platform_device *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);
 
        return 0;