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>
This commit is contained in:
Jingoo Han 2012-10-23 05:21:27 -07:00 committed by Bryan Wu
parent 50e5194385
commit f87ef10105
1 changed files with 4 additions and 7 deletions

View File

@ -43,7 +43,7 @@ static int __devinit cobalt_qube_led_probe(struct platform_device *pdev)
if (!res) if (!res)
return -EBUSY; return -EBUSY;
led_port = ioremap(res->start, resource_size(res)); led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!led_port) if (!led_port)
return -ENOMEM; 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); retval = led_classdev_register(&pdev->dev, &qube_front_led);
if (retval) if (retval)
goto err_iounmap; goto err_null;
return 0; return 0;
err_iounmap: err_null:
iounmap(led_port);
led_port = NULL; led_port = NULL;
return retval; return retval;
@ -67,10 +66,8 @@ static int __devexit cobalt_qube_led_remove(struct platform_device *pdev)
{ {
led_classdev_unregister(&qube_front_led); led_classdev_unregister(&qube_front_led);
if (led_port) { if (led_port)
iounmap(led_port);
led_port = NULL; led_port = NULL;
}
return 0; return 0;
} }