drm/amd/amdgpu/amdgpu_uvd: Fix forgotten unmap buffer object
authorzhanglianjie <zhanglianjie@uniontech.com>
Sat, 29 Jan 2022 07:35:23 +0000 (15:35 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Feb 2022 21:57:52 +0000 (16:57 -0500)
After the buffer object is successfully mapped,
call amdgpu_bo_kunmap before the function returns.

Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c

index 6f8de11a17f12e3cde1f2a16fa25ecae2b914bbf..9cc23b220537eb888f1d840e638f3a60b3ce711f 100644 (file)
@@ -834,6 +834,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
        handle = msg[2];
 
        if (handle == 0) {
+               amdgpu_bo_kunmap(bo);
                DRM_ERROR("Invalid UVD handle!\n");
                return -EINVAL;
        }
@@ -892,6 +893,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
                DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
        }
 
+       amdgpu_bo_kunmap(bo);
        return -EINVAL;
 }