gpu: nvgpu: put memory ref count

Put dma buffer ref count for all vm buffer mapping fail conditions.

Bug 200531152

Change-Id: I6bfad867eb9bd636a48b5ceb3a4417a80994a3ec
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Original Author: Bruce Xu <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2194025
(cherry picked from commit f85504ae46d65d5346d9e2a5cc84ffb960ba9fb7)
Reviewed-on: https://git-master.nvidia.com/r/2195439
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2019-09-10 15:07:17 +08:00
committed by Alex Waterman
parent b8df5bcccd
commit 920b704ec7

View File

@@ -283,6 +283,7 @@ int nvgpu_vm_map_buffer(struct vm_gk20a *vm,
(buffer_offset || *map_addr)) { (buffer_offset || *map_addr)) {
nvgpu_err(g, nvgpu_err(g,
"Regular map with addr/buf offset is not supported!"); "Regular map with addr/buf offset is not supported!");
dma_buf_put(dmabuf);
return -EINVAL; return -EINVAL;
} }
@@ -292,6 +293,7 @@ int nvgpu_vm_map_buffer(struct vm_gk20a *vm,
*/ */
if (mapping_size && !(flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET)) { if (mapping_size && !(flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET)) {
nvgpu_err(g, "map_size && non-fixed-mapping!"); nvgpu_err(g, "map_size && non-fixed-mapping!");
dma_buf_put(dmabuf);
return -EINVAL; return -EINVAL;
} }