Commit 80f0b5af authored by Daniel Vetter's avatar Daniel Vetter

drm/vmwgfx: reorder framebuffer init sequence

vmwgfx has an oddity, when failing to reference the surface it'll
return 0, since that's what the successfull drm_framebuffer_init will
leave behind in ret. Fix this up by returning -EINVAL.

Split out from all the other driver updates due to the above tiny
semantic change. Shouldn't matter though since the reference grabbing
seemingly can't fail.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c7d73f6a
...@@ -681,14 +681,10 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, ...@@ -681,14 +681,10 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
goto out_err1; goto out_err1;
} }
ret = drm_framebuffer_init(dev, &vfbs->base.base,
&vmw_framebuffer_surface_funcs);
if (ret)
goto out_err2;
if (!vmw_surface_reference(surface)) { if (!vmw_surface_reference(surface)) {
DRM_ERROR("failed to reference surface %p\n", surface); DRM_ERROR("failed to reference surface %p\n", surface);
goto out_err3; ret = -EINVAL;
goto out_err2;
} }
/* XXX get the first 3 from the surface info */ /* XXX get the first 3 from the surface info */
...@@ -707,10 +703,15 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, ...@@ -707,10 +703,15 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
*out = &vfbs->base; *out = &vfbs->base;
ret = drm_framebuffer_init(dev, &vfbs->base.base,
&vmw_framebuffer_surface_funcs);
if (ret)
goto out_err3;
return 0; return 0;
out_err3: out_err3:
drm_framebuffer_cleanup(&vfbs->base.base); vmw_surface_unreference(&surface);
out_err2: out_err2:
kfree(vfbs); kfree(vfbs);
out_err1: out_err1:
...@@ -1053,14 +1054,10 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv, ...@@ -1053,14 +1054,10 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv,
goto out_err1; goto out_err1;
} }
ret = drm_framebuffer_init(dev, &vfbd->base.base,
&vmw_framebuffer_dmabuf_funcs);
if (ret)
goto out_err2;
if (!vmw_dmabuf_reference(dmabuf)) { if (!vmw_dmabuf_reference(dmabuf)) {
DRM_ERROR("failed to reference dmabuf %p\n", dmabuf); DRM_ERROR("failed to reference dmabuf %p\n", dmabuf);
goto out_err3; ret = -EINVAL;
goto out_err2;
} }
vfbd->base.base.bits_per_pixel = mode_cmd->bpp; vfbd->base.base.bits_per_pixel = mode_cmd->bpp;
...@@ -1077,10 +1074,15 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv, ...@@ -1077,10 +1074,15 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv,
vfbd->base.user_handle = mode_cmd->handle; vfbd->base.user_handle = mode_cmd->handle;
*out = &vfbd->base; *out = &vfbd->base;
ret = drm_framebuffer_init(dev, &vfbd->base.base,
&vmw_framebuffer_dmabuf_funcs);
if (ret)
goto out_err3;
return 0; return 0;
out_err3: out_err3:
drm_framebuffer_cleanup(&vfbd->base.base); vmw_dmabuf_unreference(&dmabuf);
out_err2: out_err2:
kfree(vfbd); kfree(vfbd);
out_err1: out_err1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment