Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59cca865 authored by Vasiliy Kulikov's avatar Vasiliy Kulikov Committed by Linus Torvalds
Browse files

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: default avatarVasiliy Kulikov <segooon@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d7c7ef90
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -158,8 +158,10 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
	rtc_dev_prepare(rtc);
	rtc_dev_prepare(rtc);


	err = device_register(&rtc->dev);
	err = device_register(&rtc->dev);
	if (err)
	if (err) {
		put_device(&rtc->dev);
		goto exit_kfree;
		goto exit_kfree;
	}


	rtc_dev_add_device(rtc);
	rtc_dev_add_device(rtc);
	rtc_sysfs_add_device(rtc);
	rtc_sysfs_add_device(rtc);