Skip to contentSkip to conversation

drm/radeon/uvd: Fix forgotten unmap buffer objects

PATCH Superseded zhanglianjie 2 participants 2 messages Feb 8, 2022

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 drm/radeon/uvd: Fix forgotten unmap buffer objects

after the buffer object is successfully mapped, call radeon_bo_kunmap before the function returns.

drivers/gpu/drm/radeon/radeon_uvd.c +2 -3
index 377f9cdb5b53..0558d928d98d 100644
@@ -497,6 +497,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
 	handle = msg[2];
 
 	if (handle == 0) {
+		radeon_bo_kunmap(bo);
 		DRM_ERROR("Invalid UVD handle!\n");
 		return -EINVAL;
 	}
@@ -559,12 +560,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
 		return 0;
 
 	default:
-
 		DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
-		return -EINVAL;
 	}
 
-	BUG();
+	radeon_bo_kunmap(bo);
 	return -EINVAL;
 }
 

--
2.20.1

maintainer Reviewed-by on v2 2/2
#1 lore raw

Am 08.02.22 um 04:14 schrieb zhanglianjie:

Quoted 3 lines

after the buffer object is successfully mapped, call radeon_bo_kunmap before the function returns.

Quoted 32 lines
drivers/gpu/drm/radeon/radeon_uvd.c +2 -4
index 377f9cdb5b53..0558d928d98d 100644
@@ -497,6 +497,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
  	handle = msg[2];
 
  	if (handle == 0) {
+		radeon_bo_kunmap(bo);
  		DRM_ERROR("Invalid UVD handle!\n");
  		return -EINVAL;
  	}
@@ -559,12 +560,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
  		return 0;
 
  	default:
-
  		DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
-		return -EINVAL;
  	}
 
-	BUG();
+	radeon_bo_kunmap(bo);
  	return -EINVAL;
  }
 
--

2.20.1