aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-at91rm9200.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index a654071f57df..0eab77b22340 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -299,7 +299,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
299 "at91_rtc", pdev); 299 "at91_rtc", pdev);
300 if (ret) { 300 if (ret) {
301 dev_err(&pdev->dev, "IRQ %d already in use.\n", irq); 301 dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
302 return ret; 302 goto err_unmap;
303 } 303 }
304 304
305 /* cpu init code should really have flagged this device as 305 /* cpu init code should really have flagged this device as
@@ -311,13 +311,20 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
311 rtc = rtc_device_register(pdev->name, &pdev->dev, 311 rtc = rtc_device_register(pdev->name, &pdev->dev,
312 &at91_rtc_ops, THIS_MODULE); 312 &at91_rtc_ops, THIS_MODULE);
313 if (IS_ERR(rtc)) { 313 if (IS_ERR(rtc)) {
314 free_irq(irq, pdev); 314 ret = PTR_ERR(rtc);
315 return PTR_ERR(rtc); 315 goto err_free_irq;
316 } 316 }
317 platform_set_drvdata(pdev, rtc); 317 platform_set_drvdata(pdev, rtc);
318 318
319 dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n"); 319 dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
320 return 0; 320 return 0;
321
322err_free_irq:
323 free_irq(irq, pdev);
324err_unmap:
325 iounmap(at91_rtc_regs);
326
327 return ret;
321} 328}
322 329
323/* 330/*
@@ -334,6 +341,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
334 free_irq(irq, pdev); 341 free_irq(irq, pdev);
335 342
336 rtc_device_unregister(rtc); 343 rtc_device_unregister(rtc);
344 iounmap(at91_rtc_regs);
337 platform_set_drvdata(pdev, NULL); 345 platform_set_drvdata(pdev, NULL);
338 346
339 return 0; 347 return 0;