aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/class.c
diff options
context:
space:
mode:
authorVasiliy Kulikov <segooon@gmail.com>2010-10-27 18:33:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:03:06 -0400
commit59cca865f21e9e7beab73fcf79ba4eb776a4c228 (patch)
tree220a53454207a479af3fa04a9ffcf836811a21f8 /drivers/rtc/class.c
parentd7c7ef908b6497bb871e2e113e66e8fb0f757543 (diff)
drivers/rtc/class.c: fix device_register() error handling
If device_register() fails then call put_device(). See comment to device_register. Signed-off-by: Vasiliy Kulikov <segooon@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Wan ZongShun <mcuos.com@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r--drivers/rtc/class.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 565562ba6ac9..e6539cbabb35 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -158,8 +158,10 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
158 rtc_dev_prepare(rtc); 158 rtc_dev_prepare(rtc);
159 159
160 err = device_register(&rtc->dev); 160 err = device_register(&rtc->dev);
161 if (err) 161 if (err) {
162 put_device(&rtc->dev);
162 goto exit_kfree; 163 goto exit_kfree;
164 }
163 165
164 rtc_dev_add_device(rtc); 166 rtc_dev_add_device(rtc);
165 rtc_sysfs_add_device(rtc); 167 rtc_sysfs_add_device(rtc);