diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index 4fc9422ed86ddbccff15f7d160640cc1a0e38913..9647188fee2c66c4c172bce9923b919a2a17eef5 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c @@ -18,7 +18,7 @@ #include #include -#define DRV_VERSION "0.1" +#define DRV_VERSION "0.2" #define RTC_REG_SIZE 0x2000 #define RTC_OFFSET 0x1ff0 @@ -357,9 +357,13 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev) pdata->rtc = rtc; pdata->last_jiffies = jiffies; platform_set_drvdata(pdev, pdata); - sysfs_create_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr); + ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr); + if (ret) + goto out; return 0; out: + if (pdata->rtc) + rtc_device_unregister(pdata->rtc); if (pdata->irq >= 0) free_irq(pdata->irq, pdev); if (ioaddr) diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 01da5ab15fbc547b94b313554e2aced95169b882..6273a3d240a2afd2f4a57179d38219f6259797a1 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -17,7 +17,7 @@ #include #include -#define DRV_VERSION "0.1" +#define DRV_VERSION "0.2" #define RTC_REG_SIZE 0x800 #define RTC_OFFSET 0x7f8 @@ -196,7 +196,7 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) writeb(sec, ioaddr + RTC_SECONDS); writeb(cen & RTC_CENTURY_MASK, ioaddr + RTC_CONTROL); } - if (readb(ioaddr + RTC_DAY) & RTC_BATT_FLAG) + if (!(readb(ioaddr + RTC_DAY) & RTC_BATT_FLAG)) dev_warn(&pdev->dev, "voltage-low detected.\n"); rtc = rtc_device_register(pdev->name, &pdev->dev, @@ -208,9 +208,13 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) pdata->rtc = rtc; pdata->last_jiffies = jiffies; platform_set_drvdata(pdev, pdata); - sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); + ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); + if (ret) + goto out; return 0; out: + if (pdata->rtc) + rtc_device_unregister(pdata->rtc); if (ioaddr) iounmap(ioaddr); if (pdata->baseaddr)