Skip to content

Commit

Permalink
drivers/rtc/class.c: fix device_register() error handling
Browse files Browse the repository at this point in the history
If device_register() fails then call put_device().  See comment to
device_register.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Wan ZongShun <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
segoon authored and torvalds committed Oct 28, 2010
1 parent d7c7ef9 commit 59cca86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/rtc/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,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);
Expand Down

0 comments on commit 59cca86

Please sign in to comment.