diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 19:20:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:37 -0400 |
commit | 8925e31a9c8b12c74e4cfdc61447ed40caccb11b (patch) | |
tree | e4d61f9d46166e93b48ad3334f792957d4b762d0 /drivers/rtc/rtc-max8998.c | |
parent | 4ebabb78e46d1bc3e8ddaa8b6b88a41142756f4b (diff) |
rtc: rtc-max8998: use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-max8998.c')
-rw-r--r-- | drivers/rtc/rtc-max8998.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 8f234a075e8f..48b6612fae7f 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c | |||
@@ -256,7 +256,8 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
256 | struct max8998_rtc_info *info; | 256 | struct max8998_rtc_info *info; |
257 | int ret; | 257 | int ret; |
258 | 258 | ||
259 | info = kzalloc(sizeof(struct max8998_rtc_info), GFP_KERNEL); | 259 | info = devm_kzalloc(&pdev->dev, sizeof(struct max8998_rtc_info), |
260 | GFP_KERNEL); | ||
260 | if (!info) | 261 | if (!info) |
261 | return -ENOMEM; | 262 | return -ENOMEM; |
262 | 263 | ||
@@ -267,7 +268,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
267 | 268 | ||
268 | platform_set_drvdata(pdev, info); | 269 | platform_set_drvdata(pdev, info); |
269 | 270 | ||
270 | info->rtc_dev = rtc_device_register("max8998-rtc", &pdev->dev, | 271 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8998-rtc", |
271 | &max8998_rtc_ops, THIS_MODULE); | 272 | &max8998_rtc_ops, THIS_MODULE); |
272 | 273 | ||
273 | if (IS_ERR(info->rtc_dev)) { | 274 | if (IS_ERR(info->rtc_dev)) { |
@@ -276,8 +277,8 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
276 | goto out_rtc; | 277 | goto out_rtc; |
277 | } | 278 | } |
278 | 279 | ||
279 | ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0, | 280 | ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
280 | "rtc-alarm0", info); | 281 | max8998_rtc_alarm_irq, 0, "rtc-alarm0", info); |
281 | 282 | ||
282 | if (ret < 0) | 283 | if (ret < 0) |
283 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", | 284 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", |
@@ -294,20 +295,11 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
294 | 295 | ||
295 | out_rtc: | 296 | out_rtc: |
296 | platform_set_drvdata(pdev, NULL); | 297 | platform_set_drvdata(pdev, NULL); |
297 | kfree(info); | ||
298 | return ret; | 298 | return ret; |
299 | } | 299 | } |
300 | 300 | ||
301 | static int max8998_rtc_remove(struct platform_device *pdev) | 301 | static int max8998_rtc_remove(struct platform_device *pdev) |
302 | { | 302 | { |
303 | struct max8998_rtc_info *info = platform_get_drvdata(pdev); | ||
304 | |||
305 | if (info) { | ||
306 | free_irq(info->irq, info); | ||
307 | rtc_device_unregister(info->rtc_dev); | ||
308 | kfree(info); | ||
309 | } | ||
310 | |||
311 | return 0; | 303 | return 0; |
312 | } | 304 | } |
313 | 305 | ||