aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJani Nikula <ext-jani.1.nikula@nokia.com>2010-05-07 05:58:42 -0400
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-05-18 08:06:09 -0400
commitfce064cbda85dda330150e8d4d9f6db1a3300023 (patch)
tree700764f951851deb8cf1a5260997577bc7688c9d /drivers/video
parent368a148ea3833b540945fa53a63227c8ce76aa8f (diff)
OMAP: DSS2: Fix omap_dss_probe() error path
Perform graceful cleanup on errors instead of just bailing out. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Tested-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/core.c54
1 files changed, 41 insertions, 13 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 92ee06742ece..b3a498f22d36 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -507,7 +507,7 @@ static int omap_dss_probe(struct platform_device *pdev)
507 507
508 r = dss_get_clocks(); 508 r = dss_get_clocks();
509 if (r) 509 if (r)
510 goto fail0; 510 goto err_clocks;
511 511
512 dss_clk_enable_all_no_ctx(); 512 dss_clk_enable_all_no_ctx();
513 513
@@ -523,57 +523,64 @@ static int omap_dss_probe(struct platform_device *pdev)
523 r = dss_init(skip_init); 523 r = dss_init(skip_init);
524 if (r) { 524 if (r) {
525 DSSERR("Failed to initialize DSS\n"); 525 DSSERR("Failed to initialize DSS\n");
526 goto fail0; 526 goto err_dss;
527 } 527 }
528 528
529 r = rfbi_init(); 529 r = rfbi_init();
530 if (r) { 530 if (r) {
531 DSSERR("Failed to initialize rfbi\n"); 531 DSSERR("Failed to initialize rfbi\n");
532 goto fail0; 532 goto err_rfbi;
533 } 533 }
534 534
535 r = dpi_init(pdev); 535 r = dpi_init(pdev);
536 if (r) { 536 if (r) {
537 DSSERR("Failed to initialize dpi\n"); 537 DSSERR("Failed to initialize dpi\n");
538 goto fail0; 538 goto err_dpi;
539 } 539 }
540 540
541 r = dispc_init(); 541 r = dispc_init();
542 if (r) { 542 if (r) {
543 DSSERR("Failed to initialize dispc\n"); 543 DSSERR("Failed to initialize dispc\n");
544 goto fail0; 544 goto err_dispc;
545 } 545 }
546 546
547 r = venc_init(pdev); 547 r = venc_init(pdev);
548 if (r) { 548 if (r) {
549 DSSERR("Failed to initialize venc\n"); 549 DSSERR("Failed to initialize venc\n");
550 goto fail0; 550 goto err_venc;
551 } 551 }
552 552
553 if (cpu_is_omap34xx()) { 553 if (cpu_is_omap34xx()) {
554 r = sdi_init(skip_init); 554 r = sdi_init(skip_init);
555 if (r) { 555 if (r) {
556 DSSERR("Failed to initialize SDI\n"); 556 DSSERR("Failed to initialize SDI\n");
557 goto fail0; 557 goto err_sdi;
558 } 558 }
559 559
560 r = dsi_init(pdev); 560 r = dsi_init(pdev);
561 if (r) { 561 if (r) {
562 DSSERR("Failed to initialize DSI\n"); 562 DSSERR("Failed to initialize DSI\n");
563 goto fail0; 563 goto err_dsi;
564 } 564 }
565 } 565 }
566 566
567 r = dss_initialize_debugfs(); 567 r = dss_initialize_debugfs();
568 if (r) 568 if (r)
569 goto fail0; 569 goto err_debugfs;
570 570
571 for (i = 0; i < pdata->num_devices; ++i) { 571 for (i = 0; i < pdata->num_devices; ++i) {
572 struct omap_dss_device *dssdev = pdata->devices[i]; 572 struct omap_dss_device *dssdev = pdata->devices[i];
573 573
574 r = omap_dss_register_device(dssdev); 574 r = omap_dss_register_device(dssdev);
575 if (r) 575 if (r) {
576 DSSERR("device reg failed %d\n", i); 576 DSSERR("device %d %s register failed %d\n", i,
577 dssdev->name ?: "unnamed", r);
578
579 while (--i >= 0)
580 omap_dss_unregister_device(pdata->devices[i]);
581
582 goto err_register;
583 }
577 584
578 if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) 585 if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0)
579 pdata->default_device = dssdev; 586 pdata->default_device = dssdev;
@@ -583,8 +590,29 @@ static int omap_dss_probe(struct platform_device *pdev)
583 590
584 return 0; 591 return 0;
585 592
586 /* XXX fail correctly */ 593err_register:
587fail0: 594 dss_uninitialize_debugfs();
595err_debugfs:
596 if (cpu_is_omap34xx())
597 dsi_exit();
598err_dsi:
599 if (cpu_is_omap34xx())
600 sdi_exit();
601err_sdi:
602 venc_exit();
603err_venc:
604 dispc_exit();
605err_dispc:
606 dpi_exit();
607err_dpi:
608 rfbi_exit();
609err_rfbi:
610 dss_exit();
611err_dss:
612 dss_clk_disable_all_no_ctx();
613 dss_put_clocks();
614err_clocks:
615
588 return r; 616 return r;
589} 617}
590 618