aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-ds1553.c8
-rw-r--r--drivers/rtc/rtc-ds1742.c10
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 4fc9422ed86d..9647188fee2c 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -18,7 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#define DRV_VERSION "0.1" 21#define DRV_VERSION "0.2"
22 22
23#define RTC_REG_SIZE 0x2000 23#define RTC_REG_SIZE 0x2000
24#define RTC_OFFSET 0x1ff0 24#define RTC_OFFSET 0x1ff0
@@ -357,9 +357,13 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev)
357 pdata->rtc = rtc; 357 pdata->rtc = rtc;
358 pdata->last_jiffies = jiffies; 358 pdata->last_jiffies = jiffies;
359 platform_set_drvdata(pdev, pdata); 359 platform_set_drvdata(pdev, pdata);
360 sysfs_create_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr); 360 ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr);
361 if (ret)
362 goto out;
361 return 0; 363 return 0;
362 out: 364 out:
365 if (pdata->rtc)
366 rtc_device_unregister(pdata->rtc);
363 if (pdata->irq >= 0) 367 if (pdata->irq >= 0)
364 free_irq(pdata->irq, pdev); 368 free_irq(pdata->irq, pdev);
365 if (ioaddr) 369 if (ioaddr)
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 01da5ab15fbc..6273a3d240a2 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -17,7 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#define DRV_VERSION "0.1" 20#define DRV_VERSION "0.2"
21 21
22#define RTC_REG_SIZE 0x800 22#define RTC_REG_SIZE 0x800
23#define RTC_OFFSET 0x7f8 23#define RTC_OFFSET 0x7f8
@@ -196,7 +196,7 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev)
196 writeb(sec, ioaddr + RTC_SECONDS); 196 writeb(sec, ioaddr + RTC_SECONDS);
197 writeb(cen & RTC_CENTURY_MASK, ioaddr + RTC_CONTROL); 197 writeb(cen & RTC_CENTURY_MASK, ioaddr + RTC_CONTROL);
198 } 198 }
199 if (readb(ioaddr + RTC_DAY) & RTC_BATT_FLAG) 199 if (!(readb(ioaddr + RTC_DAY) & RTC_BATT_FLAG))
200 dev_warn(&pdev->dev, "voltage-low detected.\n"); 200 dev_warn(&pdev->dev, "voltage-low detected.\n");
201 201
202 rtc = rtc_device_register(pdev->name, &pdev->dev, 202 rtc = rtc_device_register(pdev->name, &pdev->dev,
@@ -208,9 +208,13 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev)
208 pdata->rtc = rtc; 208 pdata->rtc = rtc;
209 pdata->last_jiffies = jiffies; 209 pdata->last_jiffies = jiffies;
210 platform_set_drvdata(pdev, pdata); 210 platform_set_drvdata(pdev, pdata);
211 sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); 211 ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr);
212 if (ret)
213 goto out;
212 return 0; 214 return 0;
213 out: 215 out:
216 if (pdata->rtc)
217 rtc_device_unregister(pdata->rtc);
214 if (ioaddr) 218 if (ioaddr)
215 iounmap(ioaddr); 219 iounmap(ioaddr);
216 if (pdata->baseaddr) 220 if (pdata->baseaddr)