Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e07d2323 authored by Damien Cassou's avatar Damien Cassou Committed by Florian Tobias Schandinat
Browse files

drivers/video/epson1355fb.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: default avatarDamien Cassou <damien.cassou@lifl.fr>
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent 77621349
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -592,12 +592,8 @@ static int epson1355fb_remove(struct platform_device *dev)

	if (info) {
		fb_dealloc_cmap(&info->cmap);
		if (info->screen_base)
			iounmap(info->screen_base);
		framebuffer_release(info);
	}
	release_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN);
	release_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN);
	return 0;
}

@@ -608,14 +604,17 @@ static int __devinit epson1355fb_probe(struct platform_device *dev)
	u8 revision;
	int rc = 0;

	if (!request_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN, "S1D13505 registers")) {
	if (!devm_request_mem_region(&dev->dev, EPSON1355FB_REGS_PHYS,
				     EPSON1355FB_REGS_LEN,
				     "S1D13505 registers")) {
		printk(KERN_ERR "epson1355fb: unable to reserve "
		       "registers at 0x%0x\n", EPSON1355FB_REGS_PHYS);
		rc = -EBUSY;
		goto bail;
	}

	if (!request_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN,
	if (!devm_request_mem_region(&dev->dev, EPSON1355FB_FB_PHYS,
				     EPSON1355FB_FB_LEN,
				     "S1D13505 framebuffer")) {
		printk(KERN_ERR "epson1355fb: unable to reserve "
		       "framebuffer at 0x%0x\n", EPSON1355FB_FB_PHYS);
@@ -638,7 +637,8 @@ static int __devinit epson1355fb_probe(struct platform_device *dev)
	}
	info->pseudo_palette = default_par->pseudo_palette;

	info->screen_base = ioremap(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN);
	info->screen_base = devm_ioremap(&dev->dev, EPSON1355FB_FB_PHYS,
					 EPSON1355FB_FB_LEN);
	if (!info->screen_base) {
		printk(KERN_ERR "epson1355fb: unable to map framebuffer\n");
		rc = -ENOMEM;