Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/rtc-vr41xx.c: use devm_*() functions

Use devm_*() functions to make cleanup paths simpler, and remove
unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Yoichi Yuasa <yuasa@linux-mips.org>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jingoo Han and committed by
Linus Torvalds
bf6ce1a1 f53eeb85

+12 -38
+12 -38
drivers/rtc/rtc-vr41xx.c
··· 293 293 if (!res) 294 294 return -EBUSY; 295 295 296 - rtc1_base = ioremap(res->start, resource_size(res)); 296 + rtc1_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 297 297 if (!rtc1_base) 298 298 return -EBUSY; 299 299 ··· 303 303 goto err_rtc1_iounmap; 304 304 } 305 305 306 - rtc2_base = ioremap(res->start, resource_size(res)); 306 + rtc2_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 307 307 if (!rtc2_base) { 308 308 retval = -EBUSY; 309 309 goto err_rtc1_iounmap; 310 310 } 311 311 312 - rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE); 312 + rtc = devm_rtc_device_register(&pdev->dev, rtc_name, &vr41xx_rtc_ops, 313 + THIS_MODULE); 313 314 if (IS_ERR(rtc)) { 314 315 retval = PTR_ERR(rtc); 315 316 goto err_iounmap_all; ··· 331 330 aie_irq = platform_get_irq(pdev, 0); 332 331 if (aie_irq <= 0) { 333 332 retval = -EBUSY; 334 - goto err_device_unregister; 333 + goto err_iounmap_all; 335 334 } 336 335 337 - retval = request_irq(aie_irq, elapsedtime_interrupt, 0, 338 - "elapsed_time", pdev); 336 + retval = devm_request_irq(&pdev->dev, aie_irq, elapsedtime_interrupt, 0, 337 + "elapsed_time", pdev); 339 338 if (retval < 0) 340 - goto err_device_unregister; 339 + goto err_iounmap_all; 341 340 342 341 pie_irq = platform_get_irq(pdev, 1); 343 342 if (pie_irq <= 0) { 344 343 retval = -EBUSY; 345 - goto err_free_irq; 344 + goto err_iounmap_all; 346 345 } 347 346 348 - retval = request_irq(pie_irq, rtclong1_interrupt, 0, 349 - "rtclong1", pdev); 347 + retval = devm_request_irq(&pdev->dev, pie_irq, rtclong1_interrupt, 0, 348 + "rtclong1", pdev); 350 349 if (retval < 0) 351 - goto err_free_irq; 350 + goto err_iounmap_all; 352 351 353 352 platform_set_drvdata(pdev, rtc); 354 353 ··· 359 358 360 359 return 0; 361 360 362 - err_free_irq: 363 - free_irq(aie_irq, pdev); 364 - 365 - err_device_unregister: 366 - rtc_device_unregister(rtc); 367 - 368 361 err_iounmap_all: 369 - iounmap(rtc2_base); 370 362 rtc2_base = NULL; 371 363 372 364 err_rtc1_iounmap: 373 - iounmap(rtc1_base); 374 365 rtc1_base = NULL; 375 366 376 367 return retval; 377 - } 378 - 379 - static int rtc_remove(struct platform_device *pdev) 380 - { 381 - struct rtc_device *rtc; 382 - 383 - rtc = platform_get_drvdata(pdev); 384 - if (rtc) 385 - rtc_device_unregister(rtc); 386 - 387 - free_irq(aie_irq, pdev); 388 - free_irq(pie_irq, pdev); 389 - if (rtc1_base) 390 - iounmap(rtc1_base); 391 - if (rtc2_base) 392 - iounmap(rtc2_base); 393 - 394 - return 0; 395 368 } 396 369 397 370 /* work with hotplug and coldplug */ ··· 373 398 374 399 static struct platform_driver rtc_platform_driver = { 375 400 .probe = rtc_probe, 376 - .remove = rtc_remove, 377 401 .driver = { 378 402 .name = rtc_name, 379 403 .owner = THIS_MODULE,