/* Free a domain, only used if something went wrong in the allocation path and we need to free an already allocated page table  */
static void dma_ops_domain_free(struct dma_ops_domain *dom)
/* Free a domain, only used if something went wrong in the allocation path and we need to free an already allocated page table  */
static void dma_ops_domain_free(struct dma_ops_domain *dom)
{
	int i;
	if (!dom)
		return;
	del_domain_from_list(&dom->domain);
	free_pagetable(&dom->domain);
	for (i = 0; i < APERTURE_MAX_RANGES; ++i) {
		if (!dom->aperture[i])
			continue;
		free_page((unsigned long)dom->aperture[i]->bitmap);
		kfree(dom->aperture[i]);
	}
	kfree(dom);
}