summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-10-23 05:21:27 -0700
committerBryan Wu <cooloney@gmail.com>2012-11-26 14:28:46 -0800
commitf87ef101056a34d69d7aa2611da0eb95ff4414f9 (patch)
treeea81695847315a81d45cd46be199ce09626260ac
parent50e5194385a7be0f3c6b1f97749854cf29562619 (diff)
leds: leds-cobalt-qube: use devm_ioremap
The devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_ioremap() for these functions. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r--drivers/leds/leds-cobalt-qube.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
index 6a8725cc7b4d..86d6db74efd8 100644
--- a/drivers/leds/leds-cobalt-qube.c
+++ b/drivers/leds/leds-cobalt-qube.c
@@ -43,7 +43,7 @@ static int __devinit cobalt_qube_led_probe(struct platform_device *pdev)
if (!res)
return -EBUSY;
- led_port = ioremap(res->start, resource_size(res));
+ led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!led_port)
return -ENOMEM;
@@ -52,12 +52,11 @@ static int __devinit cobalt_qube_led_probe(struct platform_device *pdev)
retval = led_classdev_register(&pdev->dev, &qube_front_led);
if (retval)
- goto err_iounmap;
+ goto err_null;
return 0;
-err_iounmap:
- iounmap(led_port);
+err_null:
led_port = NULL;
return retval;
@@ -67,10 +66,8 @@ static int __devexit cobalt_qube_led_remove(struct platform_device *pdev)
{
led_classdev_unregister(&qube_front_led);
- if (led_port) {
- iounmap(led_port);
+ if (led_port)
led_port = NULL;
- }
return 0;
}