Skip to content

Commit

Permalink
drm/fb-helper: Add missed unlocks in setcmap_legacy()
Browse files Browse the repository at this point in the history
[ Upstream commit 0a260e7 ]

setcmap_legacy() does not call drm_modeset_unlock_all() in some exits,
add the missed unlocks with goto to fix it.

Fixes: 964c600 ("drm/fb-helper: separate the fb_setcmap helper into atomic and legacy paths")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201203144248.418281-1-hslester96@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
WillLester authored and gregkh committed Mar 4, 2021
1 parent 200e603 commit 914d619
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions drivers/gpu/drm/drm_fb_helper.c
Expand Up @@ -965,11 +965,15 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)
drm_modeset_lock_all(fb_helper->dev);
drm_client_for_each_modeset(modeset, &fb_helper->client) {
crtc = modeset->crtc;
if (!crtc->funcs->gamma_set || !crtc->gamma_size)
return -EINVAL;
if (!crtc->funcs->gamma_set || !crtc->gamma_size) {
ret = -EINVAL;
goto out;
}

if (cmap->start + cmap->len > crtc->gamma_size)
return -EINVAL;
if (cmap->start + cmap->len > crtc->gamma_size) {
ret = -EINVAL;
goto out;
}

r = crtc->gamma_store;
g = r + crtc->gamma_size;
Expand All @@ -982,8 +986,9 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)
ret = crtc->funcs->gamma_set(crtc, r, g, b,
crtc->gamma_size, NULL);
if (ret)
return ret;
goto out;
}
out:
drm_modeset_unlock_all(fb_helper->dev);

return ret;
Expand Down

0 comments on commit 914d619

Please sign in to comment.