aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/ast/ast_fb.c21
-rw-r--r--drivers/gpu/drm/bochs/bochs_fbdev.c14
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_fbdev.c12
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c2
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c22
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_fb.c12
-rw-r--r--drivers/gpu/drm/msm/msm_fbdev.c10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c21
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fbdev.c10
-rw-r--r--drivers/gpu/drm/qxl/qxl_fb.c22
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c21
-rw-r--r--drivers/gpu/drm/udl/udl_fb.c22
12 files changed, 139 insertions, 50 deletions
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 5c60ae524c45..ff68eefae273 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -335,18 +335,27 @@ int ast_fbdev_init(struct drm_device *dev)
335 335
336 ret = drm_fb_helper_init(dev, &afbdev->helper, 336 ret = drm_fb_helper_init(dev, &afbdev->helper,
337 1, 1); 337 1, 1);
338 if (ret) { 338 if (ret)
339 kfree(afbdev); 339 goto free;
340 return ret;
341 }
342 340
343 drm_fb_helper_single_add_all_connectors(&afbdev->helper); 341 ret = drm_fb_helper_single_add_all_connectors(&afbdev->helper);
342 if (ret)
343 goto fini;
344 344
345 /* disable all the possible outputs/crtcs before entering KMS mode */ 345 /* disable all the possible outputs/crtcs before entering KMS mode */
346 drm_helper_disable_unused_functions(dev); 346 drm_helper_disable_unused_functions(dev);
347 347
348 drm_fb_helper_initial_config(&afbdev->helper, 32); 348 ret = drm_fb_helper_initial_config(&afbdev->helper, 32);
349 if (ret)
350 goto fini;
351
349 return 0; 352 return 0;
353
354fini:
355 drm_fb_helper_fini(&afbdev->helper);
356free:
357 kfree(afbdev);
358 return ret;
350} 359}
351 360
352void ast_fbdev_fini(struct drm_device *dev) 361void ast_fbdev_fini(struct drm_device *dev)
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
index 61dbf09dff5d..976d9798dc99 100644
--- a/drivers/gpu/drm/bochs/bochs_fbdev.c
+++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
@@ -207,12 +207,22 @@ int bochs_fbdev_init(struct bochs_device *bochs)
207 if (ret) 207 if (ret)
208 return ret; 208 return ret;
209 209
210 drm_fb_helper_single_add_all_connectors(&bochs->fb.helper); 210 ret = drm_fb_helper_single_add_all_connectors(&bochs->fb.helper);
211 if (ret)
212 goto fini;
213
211 drm_helper_disable_unused_functions(bochs->dev); 214 drm_helper_disable_unused_functions(bochs->dev);
212 drm_fb_helper_initial_config(&bochs->fb.helper, 32); 215
216 ret = drm_fb_helper_initial_config(&bochs->fb.helper, 32);
217 if (ret)
218 goto fini;
213 219
214 bochs->fb.initialized = true; 220 bochs->fb.initialized = true;
215 return 0; 221 return 0;
222
223fini:
224 drm_fb_helper_fini(&bochs->fb.helper);
225 return ret;
216} 226}
217 227
218void bochs_fbdev_fini(struct bochs_device *bochs) 228void bochs_fbdev_fini(struct bochs_device *bochs)
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 502a89eb54b5..13ddf1c4bb8e 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -317,17 +317,17 @@ int cirrus_fbdev_init(struct cirrus_device *cdev)
317 317
318 ret = drm_fb_helper_init(cdev->dev, &gfbdev->helper, 318 ret = drm_fb_helper_init(cdev->dev, &gfbdev->helper,
319 cdev->num_crtc, CIRRUSFB_CONN_LIMIT); 319 cdev->num_crtc, CIRRUSFB_CONN_LIMIT);
320 if (ret) { 320 if (ret)
321 kfree(gfbdev); 321 return ret;
322
323 ret = drm_fb_helper_single_add_all_connectors(&gfbdev->helper);
324 if (ret)
322 return ret; 325 return ret;
323 }
324 drm_fb_helper_single_add_all_connectors(&gfbdev->helper);
325 326
326 /* disable all the possible outputs/crtcs before entering KMS mode */ 327 /* disable all the possible outputs/crtcs before entering KMS mode */
327 drm_helper_disable_unused_functions(cdev->dev); 328 drm_helper_disable_unused_functions(cdev->dev);
328 drm_fb_helper_initial_config(&gfbdev->helper, bpp_sel);
329 329
330 return 0; 330 return drm_fb_helper_initial_config(&gfbdev->helper, bpp_sel);
331} 331}
332 332
333void cirrus_fbdev_fini(struct cirrus_device *cdev) 333void cirrus_fbdev_fini(struct cirrus_device *cdev)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 52ce26d6b4fb..876f1ef0acd1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1688,7 +1688,7 @@ out:
1688 * RETURNS: 1688 * RETURNS:
1689 * Zero if everything went ok, nonzero otherwise. 1689 * Zero if everything went ok, nonzero otherwise.
1690 */ 1690 */
1691bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel) 1691int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
1692{ 1692{
1693 struct drm_device *dev = fb_helper->dev; 1693 struct drm_device *dev = fb_helper->dev;
1694 int count = 0; 1694 int count = 0;
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index ddd90ddbc200..2d42ce6d3757 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -593,6 +593,7 @@ int psb_fbdev_init(struct drm_device *dev)
593{ 593{
594 struct psb_fbdev *fbdev; 594 struct psb_fbdev *fbdev;
595 struct drm_psb_private *dev_priv = dev->dev_private; 595 struct drm_psb_private *dev_priv = dev->dev_private;
596 int ret;
596 597
597 fbdev = kzalloc(sizeof(struct psb_fbdev), GFP_KERNEL); 598 fbdev = kzalloc(sizeof(struct psb_fbdev), GFP_KERNEL);
598 if (!fbdev) { 599 if (!fbdev) {
@@ -604,16 +605,29 @@ int psb_fbdev_init(struct drm_device *dev)
604 605
605 drm_fb_helper_prepare(dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs); 606 drm_fb_helper_prepare(dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs);
606 607
607 drm_fb_helper_init(dev, &fbdev->psb_fb_helper, dev_priv->ops->crtcs, 608 ret = drm_fb_helper_init(dev, &fbdev->psb_fb_helper,
608 INTELFB_CONN_LIMIT); 609 dev_priv->ops->crtcs, INTELFB_CONN_LIMIT);
610 if (ret)
611 goto free;
609 612
610 drm_fb_helper_single_add_all_connectors(&fbdev->psb_fb_helper); 613 ret = drm_fb_helper_single_add_all_connectors(&fbdev->psb_fb_helper);
614 if (ret)
615 goto fini;
611 616
612 /* disable all the possible outputs/crtcs before entering KMS mode */ 617 /* disable all the possible outputs/crtcs before entering KMS mode */
613 drm_helper_disable_unused_functions(dev); 618 drm_helper_disable_unused_functions(dev);
614 619
615 drm_fb_helper_initial_config(&fbdev->psb_fb_helper, 32); 620 ret = drm_fb_helper_initial_config(&fbdev->psb_fb_helper, 32);
621 if (ret)
622 goto fini;
623
616 return 0; 624 return 0;
625
626fini:
627 drm_fb_helper_fini(&fbdev->psb_fb_helper);
628free:
629 kfree(fbdev);
630 return ret;
617} 631}
618 632
619static void psb_fbdev_fini(struct drm_device *dev) 633static void psb_fbdev_fini(struct drm_device *dev)
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 4415af3666ab..c36b8304042b 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -303,14 +303,22 @@ int mgag200_fbdev_init(struct mga_device *mdev)
303 if (ret) 303 if (ret)
304 return ret; 304 return ret;
305 305
306 drm_fb_helper_single_add_all_connectors(&mfbdev->helper); 306 ret = drm_fb_helper_single_add_all_connectors(&mfbdev->helper);
307 if (ret)
308 goto fini;
307 309
308 /* disable all the possible outputs/crtcs before entering KMS mode */ 310 /* disable all the possible outputs/crtcs before entering KMS mode */
309 drm_helper_disable_unused_functions(mdev->dev); 311 drm_helper_disable_unused_functions(mdev->dev);
310 312
311 drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel); 313 ret = drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel);
314 if (ret)
315 goto fini;
312 316
313 return 0; 317 return 0;
318
319fini:
320 drm_fb_helper_fini(&mfbdev->helper);
321 return ret;
314} 322}
315 323
316void mgag200_fbdev_fini(struct mga_device *mdev) 324void mgag200_fbdev_fini(struct mga_device *mdev)
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 1f3af13ccede..115b509a4a00 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -241,17 +241,23 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
241 goto fail; 241 goto fail;
242 } 242 }
243 243
244 drm_fb_helper_single_add_all_connectors(helper); 244 ret = drm_fb_helper_single_add_all_connectors(helper);
245 if (ret)
246 goto fini;
245 247
246 /* disable all the possible outputs/crtcs before entering KMS mode */ 248 /* disable all the possible outputs/crtcs before entering KMS mode */
247 drm_helper_disable_unused_functions(dev); 249 drm_helper_disable_unused_functions(dev);
248 250
249 drm_fb_helper_initial_config(helper, 32); 251 ret = drm_fb_helper_initial_config(helper, 32);
252 if (ret)
253 goto fini;
250 254
251 priv->fbdev = helper; 255 priv->fbdev = helper;
252 256
253 return helper; 257 return helper;
254 258
259fini:
260 drm_fb_helper_fini(helper);
255fail: 261fail:
256 kfree(fbdev); 262 kfree(fbdev);
257 return NULL; 263 return NULL;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 3ed12a8cfc91..5a7705dcd67e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -539,12 +539,12 @@ nouveau_fbcon_init(struct drm_device *dev)
539 539
540 ret = drm_fb_helper_init(dev, &fbcon->helper, 540 ret = drm_fb_helper_init(dev, &fbcon->helper,
541 dev->mode_config.num_crtc, 4); 541 dev->mode_config.num_crtc, 4);
542 if (ret) { 542 if (ret)
543 kfree(fbcon); 543 goto free;
544 return ret;
545 }
546 544
547 drm_fb_helper_single_add_all_connectors(&fbcon->helper); 545 ret = drm_fb_helper_single_add_all_connectors(&fbcon->helper);
546 if (ret)
547 goto fini;
548 548
549 if (drm->device.info.ram_size <= 32 * 1024 * 1024) 549 if (drm->device.info.ram_size <= 32 * 1024 * 1024)
550 preferred_bpp = 8; 550 preferred_bpp = 8;
@@ -557,8 +557,17 @@ nouveau_fbcon_init(struct drm_device *dev)
557 /* disable all the possible outputs/crtcs before entering KMS mode */ 557 /* disable all the possible outputs/crtcs before entering KMS mode */
558 drm_helper_disable_unused_functions(dev); 558 drm_helper_disable_unused_functions(dev);
559 559
560 drm_fb_helper_initial_config(&fbcon->helper, preferred_bpp); 560 ret = drm_fb_helper_initial_config(&fbcon->helper, preferred_bpp);
561 if (ret)
562 goto fini;
563
561 return 0; 564 return 0;
565
566fini:
567 drm_fb_helper_fini(&fbcon->helper);
568free:
569 kfree(fbcon);
570 return ret;
562} 571}
563 572
564void 573void
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 8436c6857cda..d292d24b3a6e 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -334,17 +334,23 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
334 goto fail; 334 goto fail;
335 } 335 }
336 336
337 drm_fb_helper_single_add_all_connectors(helper); 337 ret = drm_fb_helper_single_add_all_connectors(helper);
338 if (ret)
339 goto fini;
338 340
339 /* disable all the possible outputs/crtcs before entering KMS mode */ 341 /* disable all the possible outputs/crtcs before entering KMS mode */
340 drm_helper_disable_unused_functions(dev); 342 drm_helper_disable_unused_functions(dev);
341 343
342 drm_fb_helper_initial_config(helper, 32); 344 ret = drm_fb_helper_initial_config(helper, 32);
345 if (ret)
346 goto fini;
343 347
344 priv->fbdev = helper; 348 priv->fbdev = helper;
345 349
346 return helper; 350 return helper;
347 351
352fini:
353 drm_fb_helper_fini(helper);
348fail: 354fail:
349 kfree(fbdev); 355 kfree(fbdev);
350 return NULL; 356 return NULL;
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 3d7c1d00a424..f778c0e8ae3c 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -686,14 +686,24 @@ int qxl_fbdev_init(struct qxl_device *qdev)
686 ret = drm_fb_helper_init(qdev->ddev, &qfbdev->helper, 686 ret = drm_fb_helper_init(qdev->ddev, &qfbdev->helper,
687 qxl_num_crtc /* num_crtc - QXL supports just 1 */, 687 qxl_num_crtc /* num_crtc - QXL supports just 1 */,
688 QXLFB_CONN_LIMIT); 688 QXLFB_CONN_LIMIT);
689 if (ret) { 689 if (ret)
690 kfree(qfbdev); 690 goto free;
691 return ret; 691
692 } 692 ret = drm_fb_helper_single_add_all_connectors(&qfbdev->helper);
693 if (ret)
694 goto fini;
695
696 ret = drm_fb_helper_initial_config(&qfbdev->helper, bpp_sel);
697 if (ret)
698 goto fini;
693 699
694 drm_fb_helper_single_add_all_connectors(&qfbdev->helper);
695 drm_fb_helper_initial_config(&qfbdev->helper, bpp_sel);
696 return 0; 700 return 0;
701
702fini:
703 drm_fb_helper_fini(&qfbdev->helper);
704free:
705 kfree(qfbdev);
706 return ret;
697} 707}
698 708
699void qxl_fbdev_fini(struct qxl_device *qdev) 709void qxl_fbdev_fini(struct qxl_device *qdev)
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 29b9220ec399..3000bc4c136b 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -390,18 +390,27 @@ int radeon_fbdev_init(struct radeon_device *rdev)
390 ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper, 390 ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper,
391 rdev->num_crtc, 391 rdev->num_crtc,
392 RADEONFB_CONN_LIMIT); 392 RADEONFB_CONN_LIMIT);
393 if (ret) { 393 if (ret)
394 kfree(rfbdev); 394 goto free;
395 return ret;
396 }
397 395
398 drm_fb_helper_single_add_all_connectors(&rfbdev->helper); 396 ret = drm_fb_helper_single_add_all_connectors(&rfbdev->helper);
397 if (ret)
398 goto fini;
399 399
400 /* disable all the possible outputs/crtcs before entering KMS mode */ 400 /* disable all the possible outputs/crtcs before entering KMS mode */
401 drm_helper_disable_unused_functions(rdev->ddev); 401 drm_helper_disable_unused_functions(rdev->ddev);
402 402
403 drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); 403 ret = drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
404 if (ret)
405 goto fini;
406
404 return 0; 407 return 0;
408
409fini:
410 drm_fb_helper_fini(&rfbdev->helper);
411free:
412 kfree(rfbdev);
413 return ret;
405} 414}
406 415
407void radeon_fbdev_fini(struct radeon_device *rdev) 416void radeon_fbdev_fini(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 8cbcb4589bd3..5fc16cecd3ba 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -589,19 +589,27 @@ int udl_fbdev_init(struct drm_device *dev)
589 589
590 ret = drm_fb_helper_init(dev, &ufbdev->helper, 590 ret = drm_fb_helper_init(dev, &ufbdev->helper,
591 1, 1); 591 1, 1);
592 if (ret) { 592 if (ret)
593 kfree(ufbdev); 593 goto free;
594 return ret;
595
596 }
597 594
598 drm_fb_helper_single_add_all_connectors(&ufbdev->helper); 595 ret = drm_fb_helper_single_add_all_connectors(&ufbdev->helper);
596 if (ret)
597 goto fini;
599 598
600 /* disable all the possible outputs/crtcs before entering KMS mode */ 599 /* disable all the possible outputs/crtcs before entering KMS mode */
601 drm_helper_disable_unused_functions(dev); 600 drm_helper_disable_unused_functions(dev);
602 601
603 drm_fb_helper_initial_config(&ufbdev->helper, bpp_sel); 602 ret = drm_fb_helper_initial_config(&ufbdev->helper, bpp_sel);
603 if (ret)
604 goto fini;
605
604 return 0; 606 return 0;
607
608fini:
609 drm_fb_helper_fini(&ufbdev->helper);
610free:
611 kfree(ufbdev);
612 return ret;
605} 613}
606 614
607void udl_fbdev_cleanup(struct drm_device *dev) 615void udl_fbdev_cleanup(struct drm_device *dev)