aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at32ap700x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-at32ap700x.c')
-rw-r--r--drivers/rtc/rtc-at32ap700x.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 2999214ca534..d3b9b14267ab 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -225,18 +225,12 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
225 goto out; 225 goto out;
226 } 226 }
227 227
228 ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
229 if (ret) {
230 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
231 goto out;
232 }
233
234 rtc->irq = irq; 228 rtc->irq = irq;
235 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1); 229 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1);
236 if (!rtc->regs) { 230 if (!rtc->regs) {
237 ret = -ENOMEM; 231 ret = -ENOMEM;
238 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 232 dev_dbg(&pdev->dev, "could not map I/O memory\n");
239 goto out_free_irq; 233 goto out;
240 } 234 }
241 spin_lock_init(&rtc->lock); 235 spin_lock_init(&rtc->lock);
242 236
@@ -253,12 +247,18 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
253 | RTC_BIT(CTRL_EN)); 247 | RTC_BIT(CTRL_EN));
254 } 248 }
255 249
250 ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
251 if (ret) {
252 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
253 goto out_iounmap;
254 }
255
256 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 256 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
257 &at32_rtc_ops, THIS_MODULE); 257 &at32_rtc_ops, THIS_MODULE);
258 if (IS_ERR(rtc->rtc)) { 258 if (IS_ERR(rtc->rtc)) {
259 dev_dbg(&pdev->dev, "could not register rtc device\n"); 259 dev_dbg(&pdev->dev, "could not register rtc device\n");
260 ret = PTR_ERR(rtc->rtc); 260 ret = PTR_ERR(rtc->rtc);
261 goto out_iounmap; 261 goto out_free_irq;
262 } 262 }
263 263
264 platform_set_drvdata(pdev, rtc); 264 platform_set_drvdata(pdev, rtc);
@@ -268,10 +268,10 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
268 268
269 return 0; 269 return 0;
270 270
271out_iounmap:
272 iounmap(rtc->regs);
273out_free_irq: 271out_free_irq:
274 free_irq(irq, rtc); 272 free_irq(irq, rtc);
273out_iounmap:
274 iounmap(rtc->regs);
275out: 275out:
276 kfree(rtc); 276 kfree(rtc);
277 return ret; 277 return ret;