Commit 50e51943 authored by Jingoo Han's avatar Jingoo Han Committed by Bryan Wu

leds: leds-cobalt-raq: 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: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
parent aa2dcf9d
...@@ -85,13 +85,13 @@ static int __devinit cobalt_raq_led_probe(struct platform_device *pdev) ...@@ -85,13 +85,13 @@ static int __devinit cobalt_raq_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;
retval = led_classdev_register(&pdev->dev, &raq_power_off_led); retval = led_classdev_register(&pdev->dev, &raq_power_off_led);
if (retval) if (retval)
goto err_iounmap; goto err_null;
retval = led_classdev_register(&pdev->dev, &raq_web_led); retval = led_classdev_register(&pdev->dev, &raq_web_led);
if (retval) if (retval)
...@@ -102,8 +102,7 @@ static int __devinit cobalt_raq_led_probe(struct platform_device *pdev) ...@@ -102,8 +102,7 @@ static int __devinit cobalt_raq_led_probe(struct platform_device *pdev)
err_unregister: err_unregister:
led_classdev_unregister(&raq_power_off_led); led_classdev_unregister(&raq_power_off_led);
err_iounmap: err_null:
iounmap(led_port);
led_port = NULL; led_port = NULL;
return retval; return retval;
...@@ -114,10 +113,8 @@ static int __devexit cobalt_raq_led_remove(struct platform_device *pdev) ...@@ -114,10 +113,8 @@ static int __devexit cobalt_raq_led_remove(struct platform_device *pdev)
led_classdev_unregister(&raq_power_off_led); led_classdev_unregister(&raq_power_off_led);
led_classdev_unregister(&raq_web_led); led_classdev_unregister(&raq_web_led);
if (led_port) { if (led_port)
iounmap(led_port);
led_port = NULL; led_port = NULL;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment