@@ -655,12 +655,13 @@ static int __setplane_internal(struct drm_plane *plane,
if (!fb) {
plane->old_fb = plane->fb;
ret = plane->funcs->disable_plane(plane, ctx);
- if (!ret) {
- plane->crtc = NULL;
- plane->fb = NULL;
- } else {
+ if (ret) {
plane->old_fb = NULL;
+ return ret;
}
+
+ plane->crtc = NULL;
+ plane->fb = NULL;
goto out;
}
@@ -668,20 +669,22 @@ static int __setplane_internal(struct drm_plane *plane,
crtc_x, crtc_y, crtc_w, crtc_h,
src_x, src_y, src_w, src_h);
if (ret)
- goto out;
+ return ret;
plane->old_fb = plane->fb;
+
ret = plane->funcs->update_plane(plane, crtc, fb,
crtc_x, crtc_y, crtc_w, crtc_h,
src_x, src_y, src_w, src_h, ctx);
- if (!ret) {
- plane->crtc = crtc;
- plane->fb = fb;
- drm_framebuffer_get(plane->fb);
- } else {
+ if (ret) {
plane->old_fb = NULL;
+ return ret;
}
+ plane->crtc = crtc;
+ plane->fb = fb;
+ drm_framebuffer_get(plane->fb);
+
out:
if (plane->old_fb)
drm_framebuffer_put(plane->old_fb);
@@ -1049,15 +1052,14 @@ static int page_flip_internal(struct drm_crtc *crtc,
target_vblank, ctx);
else
ret = crtc->funcs->page_flip(crtc, fb, e, flags, ctx);
-
if (ret) {
- /* Keep the old fb, don't unref it. */
plane->old_fb = NULL;
- } else {
- plane->fb = fb;
- drm_framebuffer_get(plane->fb);
+ return ret;
}
+ plane->fb = fb;
+ drm_framebuffer_get(plane->fb);
+
if (plane->old_fb)
drm_framebuffer_put(plane->old_fb);
plane->old_fb = NULL;