diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2018-05-23 19:42:58 +0200 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2018-05-23 19:42:58 +0200 |
commit | e743a0a252f46dc2e19102b39d3058750a0b1bdb (patch) | |
tree | cf8b12494ea08e2adc3cfae63f757a01d43da0a0 | |
parent | 6bf3072194c3353d37c0a7575dbcac77c797598c (diff) |
Fix surface allocation
-rw-r--r-- | surface.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); } |