Skip to content

Commit be86781

Browse files
Damien Cassouschandinat
Damien Cassou
authored andcommitted
drivers/video/ep93xx-fb.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Damien Cassou <[email protected]> Signed-off-by: Florian Tobias Schandinat <[email protected]>
1 parent d5c0eed commit be86781

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

drivers/video/ep93xx-fb.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
529529
* any of the framebuffer registers.
530530
*/
531531
fbi->res = res;
532-
fbi->mmio_base = ioremap(res->start, resource_size(res));
532+
fbi->mmio_base = devm_ioremap(&pdev->dev, res->start,
533+
resource_size(res));
533534
if (!fbi->mmio_base) {
534535
err = -ENXIO;
535536
goto failed_resource;
@@ -553,20 +554,20 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
553554
if (err == 0) {
554555
dev_err(info->dev, "No suitable video mode found\n");
555556
err = -EINVAL;
556-
goto failed_mode;
557+
goto failed_resource;
557558
}
558559

559560
if (mach_info->setup) {
560561
err = mach_info->setup(pdev);
561562
if (err)
562-
goto failed_mode;
563+
goto failed_resource;
563564
}
564565

565566
err = ep93xxfb_check_var(&info->var, info);
566567
if (err)
567568
goto failed_check;
568569

569-
fbi->clk = clk_get(info->dev, NULL);
570+
fbi->clk = devm_clk_get(&pdev->dev, NULL);
570571
if (IS_ERR(fbi->clk)) {
571572
err = PTR_ERR(fbi->clk);
572573
fbi->clk = NULL;
@@ -578,19 +579,15 @@ static int __devinit ep93xxfb_probe(struct platform_device *pdev)
578579

579580
err = register_framebuffer(info);
580581
if (err)
581-
goto failed;
582+
goto failed_check;
582583

583584
dev_info(info->dev, "registered. Mode = %dx%d-%d\n",
584585
info->var.xres, info->var.yres, info->var.bits_per_pixel);
585586
return 0;
586587

587-
failed:
588-
clk_put(fbi->clk);
589588
failed_check:
590589
if (fbi->mach_info->teardown)
591590
fbi->mach_info->teardown(pdev);
592-
failed_mode:
593-
iounmap(fbi->mmio_base);
594591
failed_resource:
595592
ep93xxfb_dealloc_videomem(info);
596593
failed_videomem:
@@ -609,8 +606,6 @@ static int __devexit ep93xxfb_remove(struct platform_device *pdev)
609606

610607
unregister_framebuffer(info);
611608
clk_disable(fbi->clk);
612-
clk_put(fbi->clk);
613-
iounmap(fbi->mmio_base);
614609
ep93xxfb_dealloc_videomem(info);
615610
fb_dealloc_cmap(&info->cmap);
616611

0 commit comments

Comments
 (0)