drivers/video/cobalt_lcdfb.c: use devm_ functions
authorDamien Cassou <damien.cassou@lifl.fr>
Tue, 31 Jul 2012 13:54:18 +0000 (15:54 +0200)
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Thu, 23 Aug 2012 12:59:02 +0000 (12:59 +0000)
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 <damien.cassou@lifl.fr>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
drivers/video/cobalt_lcdfb.c

index eae46f6457e2a59788c1fbd46995cab8ea6739c4..01a4ee7cc6b1b069be59593fa9baef0ec37c3176 100644 (file)
@@ -348,7 +348,8 @@ static int __devinit cobalt_lcdfb_probe(struct platform_device *dev)
        }
 
        info->screen_size = resource_size(res);
-       info->screen_base = ioremap(res->start, info->screen_size);
+       info->screen_base = devm_ioremap(&dev->dev, res->start,
+                                        info->screen_size);
        info->fbops = &cobalt_lcd_fbops;
        info->fix = cobalt_lcdfb_fix;
        info->fix.smem_start = res->start;
@@ -359,7 +360,6 @@ static int __devinit cobalt_lcdfb_probe(struct platform_device *dev)
 
        retval = register_framebuffer(info);
        if (retval < 0) {
-               iounmap(info->screen_base);
                framebuffer_release(info);
                return retval;
        }
@@ -380,7 +380,6 @@ static int __devexit cobalt_lcdfb_remove(struct platform_device *dev)
 
        info = platform_get_drvdata(dev);
        if (info) {
-               iounmap(info->screen_base);
                unregister_framebuffer(info);
                framebuffer_release(info);
        }