aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/ep93xx-fb.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-04-18 15:37:08 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-04-21 17:47:49 -0400
commit045dfdb5c5e8fe49afe1de82fb94eaae8121e059 (patch)
tree6bd555424eac28a2b13277920fbc358a39c2de88 /drivers/video/ep93xx-fb.c
parent49a8ee8ac3f20e4d8fe284012c082a793982d48f (diff)
drivers/video/ep93xx-fb.c: clean up error-handling code
There were two problems in this code: failure of the setup function should free locally allocated resources like other nearby failures, and the test if (&info->cmap) can never be false. To generally clean things up, this patch reorders the error handling code at the failed label and adds labels so that the conditionals are not necessary. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ryan Mallon <rmallon@gmail.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/ep93xx-fb.c')
-rw-r--r--drivers/video/ep93xx-fb.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c
index f8babbeee27..345d9623097 100644
--- a/drivers/video/ep93xx-fb.c
+++ b/drivers/video/ep93xx-fb.c
@@ -507,16 +507,16 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
507 507
508 err = fb_alloc_cmap(&info->cmap, 256, 0); 508 err = fb_alloc_cmap(&info->cmap, 256, 0);
509 if (err) 509 if (err)
510 goto failed; 510 goto failed_cmap;
511 511
512 err = ep93xxfb_alloc_videomem(info); 512 err = ep93xxfb_alloc_videomem(info);
513 if (err) 513 if (err)
514 goto failed; 514 goto failed_videomem;
515 515
516 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 516 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
517 if (!res) { 517 if (!res) {
518 err = -ENXIO; 518 err = -ENXIO;
519 goto failed; 519 goto failed_resource;
520 } 520 }
521 521
522 /* 522 /*
@@ -532,7 +532,7 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
532 fbi->mmio_base = ioremap(res->start, resource_size(res)); 532 fbi->mmio_base = ioremap(res->start, resource_size(res));
533 if (!fbi->mmio_base) { 533 if (!fbi->mmio_base) {
534 err = -ENXIO; 534 err = -ENXIO;
535 goto failed; 535 goto failed_resource;
536 } 536 }
537 537
538 strcpy(info->fix.id, pdev->name); 538 strcpy(info->fix.id, pdev->name);
@@ -553,24 +553,24 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
553 if (err == 0) { 553 if (err == 0) {
554 dev_err(info->dev, "No suitable video mode found\n"); 554 dev_err(info->dev, "No suitable video mode found\n");
555 err = -EINVAL; 555 err = -EINVAL;
556 goto failed; 556 goto failed_mode;
557 } 557 }
558 558
559 if (mach_info->setup) { 559 if (mach_info->setup) {
560 err = mach_info->setup(pdev); 560 err = mach_info->setup(pdev);
561 if (err) 561 if (err)
562 return err; 562 goto failed_mode;
563 } 563 }
564 564
565 err = ep93xxfb_check_var(&info->var, info); 565 err = ep93xxfb_check_var(&info->var, info);
566 if (err) 566 if (err)
567 goto failed; 567 goto failed_check;
568 568
569 fbi->clk = clk_get(info->dev, NULL); 569 fbi->clk = clk_get(info->dev, NULL);
570 if (IS_ERR(fbi->clk)) { 570 if (IS_ERR(fbi->clk)) {
571 err = PTR_ERR(fbi->clk); 571 err = PTR_ERR(fbi->clk);
572 fbi->clk = NULL; 572 fbi->clk = NULL;
573 goto failed; 573 goto failed_check;
574 } 574 }
575 575
576 ep93xxfb_set_par(info); 576 ep93xxfb_set_par(info);
@@ -585,15 +585,17 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
585 return 0; 585 return 0;
586 586
587failed: 587failed:
588 if (fbi->clk) 588 clk_put(fbi->clk);
589 clk_put(fbi->clk); 589failed_check:
590 if (fbi->mmio_base)
591 iounmap(fbi->mmio_base);
592 ep93xxfb_dealloc_videomem(info);
593 if (&info->cmap)
594 fb_dealloc_cmap(&info->cmap);
595 if (fbi->mach_info->teardown) 590 if (fbi->mach_info->teardown)
596 fbi->mach_info->teardown(pdev); 591 fbi->mach_info->teardown(pdev);
592failed_mode:
593 iounmap(fbi->mmio_base);
594failed_resource:
595 ep93xxfb_dealloc_videomem(info);
596failed_videomem:
597 fb_dealloc_cmap(&info->cmap);
598failed_cmap:
597 kfree(info); 599 kfree(info);
598 platform_set_drvdata(pdev, NULL); 600 platform_set_drvdata(pdev, NULL);
599 601