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, 5 insertions, 15 deletions
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 128896da1a14..3161ab5263ed 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -212,23 +212,20 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
212 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 212 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
213 if (!regs) { 213 if (!regs) {
214 dev_dbg(&pdev->dev, "no mmio resource defined\n"); 214 dev_dbg(&pdev->dev, "no mmio resource defined\n");
215 ret = -ENXIO; 215 return -ENXIO;
216 goto out;
217 } 216 }
218 217
219 irq = platform_get_irq(pdev, 0); 218 irq = platform_get_irq(pdev, 0);
220 if (irq <= 0) { 219 if (irq <= 0) {
221 dev_dbg(&pdev->dev, "could not get irq\n"); 220 dev_dbg(&pdev->dev, "could not get irq\n");
222 ret = -ENXIO; 221 return -ENXIO;
223 goto out;
224 } 222 }
225 223
226 rtc->irq = irq; 224 rtc->irq = irq;
227 rtc->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs)); 225 rtc->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
228 if (!rtc->regs) { 226 if (!rtc->regs) {
229 ret = -ENOMEM;
230 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 227 dev_dbg(&pdev->dev, "could not map I/O memory\n");
231 goto out; 228 return -ENOMEM;
232 } 229 }
233 spin_lock_init(&rtc->lock); 230 spin_lock_init(&rtc->lock);
234 231
@@ -249,7 +246,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
249 "rtc", rtc); 246 "rtc", rtc);
250 if (ret) { 247 if (ret) {
251 dev_dbg(&pdev->dev, "could not request irq %d\n", irq); 248 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
252 goto out; 249 return ret;
253 } 250 }
254 251
255 platform_set_drvdata(pdev, rtc); 252 platform_set_drvdata(pdev, rtc);
@@ -258,8 +255,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
258 &at32_rtc_ops, THIS_MODULE); 255 &at32_rtc_ops, THIS_MODULE);
259 if (IS_ERR(rtc->rtc)) { 256 if (IS_ERR(rtc->rtc)) {
260 dev_dbg(&pdev->dev, "could not register rtc device\n"); 257 dev_dbg(&pdev->dev, "could not register rtc device\n");
261 ret = PTR_ERR(rtc->rtc); 258 return PTR_ERR(rtc->rtc);
262 goto out;
263 } 259 }
264 260
265 device_init_wakeup(&pdev->dev, 1); 261 device_init_wakeup(&pdev->dev, 1);
@@ -268,18 +264,12 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
268 (unsigned long)rtc->regs, rtc->irq); 264 (unsigned long)rtc->regs, rtc->irq);
269 265
270 return 0; 266 return 0;
271
272out:
273 platform_set_drvdata(pdev, NULL);
274 return ret;
275} 267}
276 268
277static int __exit at32_rtc_remove(struct platform_device *pdev) 269static int __exit at32_rtc_remove(struct platform_device *pdev)
278{ 270{
279 device_init_wakeup(&pdev->dev, 0); 271 device_init_wakeup(&pdev->dev, 0);
280 272
281 platform_set_drvdata(pdev, NULL);
282
283 return 0; 273 return 0;
284} 274}
285 275