aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-07 11:16:03 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-07 15:36:28 -0500
commitda7bdda2afdf1ae58546218b50771c2c646bb079 (patch)
treeacfc6c3e7f36f9726853be233d402e6b201c2215 /drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
parented84e2542d2278bf1eff14b6bbd60ba74c8a5602 (diff)
drm/fb-helper: Automatically clean up fb_info
Noticed that everyone duplicates the same logic here and we could safe a few lines per driver. Yay for lots of drivers to make such tiny refactors worth-while! v2: Forgot to git add everything :( v3: Actually remove release_fbi (Sean, Emil, Chris) ... Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <seanpaul@chromium.org> Cc: Noralf Trønnes <noralf@tronnes.org> Cc: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170207161603.17611-1-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 36ce3cac81ba..72505b15dd13 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -224,7 +224,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
224 info = drm_fb_helper_alloc_fbi(helper); 224 info = drm_fb_helper_alloc_fbi(helper);
225 if (IS_ERR(info)) { 225 if (IS_ERR(info)) {
226 ret = PTR_ERR(info); 226 ret = PTR_ERR(info);
227 goto out_unref; 227 goto out;
228 } 228 }
229 229
230 info->par = rfbdev; 230 info->par = rfbdev;
@@ -233,7 +233,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
233 ret = amdgpu_framebuffer_init(adev->ddev, &rfbdev->rfb, &mode_cmd, gobj); 233 ret = amdgpu_framebuffer_init(adev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
234 if (ret) { 234 if (ret) {
235 DRM_ERROR("failed to initialize framebuffer %d\n", ret); 235 DRM_ERROR("failed to initialize framebuffer %d\n", ret);
236 goto out_destroy_fbi; 236 goto out;
237 } 237 }
238 238
239 fb = &rfbdev->rfb.base; 239 fb = &rfbdev->rfb.base;
@@ -266,7 +266,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
266 266
267 if (info->screen_base == NULL) { 267 if (info->screen_base == NULL) {
268 ret = -ENOSPC; 268 ret = -ENOSPC;
269 goto out_destroy_fbi; 269 goto out;
270 } 270 }
271 271
272 DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start); 272 DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start);
@@ -278,9 +278,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
278 vga_switcheroo_client_fb_set(adev->ddev->pdev, info); 278 vga_switcheroo_client_fb_set(adev->ddev->pdev, info);
279 return 0; 279 return 0;
280 280
281out_destroy_fbi: 281out:
282 drm_fb_helper_release_fbi(helper);
283out_unref:
284 if (abo) { 282 if (abo) {
285 283
286 } 284 }
@@ -304,7 +302,6 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfb
304 struct amdgpu_framebuffer *rfb = &rfbdev->rfb; 302 struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
305 303
306 drm_fb_helper_unregister_fbi(&rfbdev->helper); 304 drm_fb_helper_unregister_fbi(&rfbdev->helper);
307 drm_fb_helper_release_fbi(&rfbdev->helper);
308 305
309 if (rfb->obj) { 306 if (rfb->obj) {
310 amdgpufb_destroy_pinned_object(rfb->obj); 307 amdgpufb_destroy_pinned_object(rfb->obj);