aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZou Wei <[email protected]>2021-05-13 16:46:04 +0800
committerThomas Zimmermann <[email protected]>2021-05-13 15:06:32 +0200
commit858aa5a4be22368f8d0e8ace7dc0b5ffb62bbdbc (patch)
treeaa32b8374cb0b7cdabaf91a55373058787326555
parentd84680d359378a79664fa840cd144ba0f715968d (diff)
drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
Add the missing unlock before return from function devm_aperture_acquire() in the error handling case. Signed-off-by: Zou Wei <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Reported-by: Hulk Robot <[email protected]> Fixes: 730e7992dc1b ("drm/aperture: Add infrastructure for aperture ownership") Cc: Thomas Zimmermann <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/drm_aperture.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_aperture.c b/drivers/gpu/drm/drm_aperture.c
index 33bf018c3bdf..9335d9d6cf9a 100644
--- a/drivers/gpu/drm/drm_aperture.c
+++ b/drivers/gpu/drm/drm_aperture.c
@@ -164,13 +164,17 @@ static int devm_aperture_acquire(struct drm_device *dev,
list_for_each(pos, &drm_apertures) {
ap = container_of(pos, struct drm_aperture, lh);
- if (overlap(base, end, ap->base, ap->base + ap->size))
+ if (overlap(base, end, ap->base, ap->base + ap->size)) {
+ mutex_unlock(&drm_apertures_lock);
return -EBUSY;
+ }
}
ap = devm_kzalloc(dev->dev, sizeof(*ap), GFP_KERNEL);
- if (!ap)
+ if (!ap) {
+ mutex_unlock(&drm_apertures_lock);
return -ENOMEM;
+ }
ap->dev = dev;
ap->base = base;