@@ -138,17 +138,22 @@ int cirrus_device_init(struct cirrus_device *cdev,
}
cdev->rmmio = ioremap(cdev->rmmio_base, cdev->rmmio_size);
-
- if (cdev->rmmio == NULL)
- return -ENOMEM;
+ if (cdev->rmmio == NULL) {
+ ret = -ENOMEM;
+ goto err_ioremap;
+ }
ret = cirrus_vram_init(cdev);
- if (ret) {
- release_mem_region(cdev->rmmio_base, cdev->rmmio_size);
- return ret;
- }
+ if (ret)
+ goto err_init;
return 0;
+
+err_init:
+ iounmap(cdev->rmmio);
+err_ioremap:
+ release_mem_region(cdev->rmmio_base, cdev->rmmio_size);
+ return ret;
}
void cirrus_device_fini(struct cirrus_device *cdev)