m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--surface.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/surface.c b/surface.c
index ef701ea..bb6766f 100644
--- a/surface.c
+++ b/surface.c
@@ -240,7 +240,7 @@ int alloc_surface_buffer(struct doomdev_ioctl_create_surface *params,
dma_alloc_coherent(surface_data->doom_data->pci_device,
bytes_needed, &surface_data->surface_dev, GFP_KERNEL);
- ORFAIL_NULL(surface_data->surface_cpu, -ENOMEM, error_pt);
+ ORFAIL_NULL(surface_data->surface_cpu, -ENOMEM, error_surface);
surface_data->page_table_cpu =
dma_alloc_coherent(surface_data->doom_data->pci_device,
@@ -258,17 +258,21 @@ int alloc_surface_buffer(struct doomdev_ioctl_create_surface *params,
return 0;
error_pt:
+ dma_free_coherent(surface_data->doom_data->pci_device,
+ surface_data->surface_size,
+ surface_data->surface_cpu, surface_data->surface_dev);
+error_surface:
return err;
}
void free_surface_buffer(struct surface_data *surface_data)
{
- dma_free_coherent(surface_data->doom_data->device,
+ dma_free_coherent(surface_data->doom_data->pci_device,
surface_data->surface_size,
surface_data->surface_cpu, surface_data->surface_dev);
- dma_free_coherent(surface_data->doom_data->device,
- surface_data->pages,
+ dma_free_coherent(surface_data->doom_data->pci_device,
+ surface_data->pages * 4,
surface_data->page_table_cpu, surface_data->page_table_dev);
}