Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~shefty/rdma-dev.git] / drivers / rtc / class.c
index 3243832a17cda4fa5ef88c451dfd011316637e47..9583cbcc6b79da8b541fcb7b4cfa5c90fe648bf0 100644 (file)
@@ -171,8 +171,10 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
        rtc_dev_prepare(rtc);
 
        err = device_register(&rtc->dev);
-       if (err)
+       if (err) {
+               put_device(&rtc->dev);
                goto exit_kfree;
+       }
 
        rtc_dev_add_device(rtc);
        rtc_sysfs_add_device(rtc);