|
@@ -234,8 +234,9 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
|
|
|
|
|
|
err = device_register(&rtc->dev);
|
|
err = device_register(&rtc->dev);
|
|
if (err) {
|
|
if (err) {
|
|
|
|
+ /* This will free both memory and the ID */
|
|
put_device(&rtc->dev);
|
|
put_device(&rtc->dev);
|
|
- goto exit_kfree;
|
|
|
|
|
|
+ goto exit;
|
|
}
|
|
}
|
|
|
|
|
|
rtc_dev_add_device(rtc);
|
|
rtc_dev_add_device(rtc);
|
|
@@ -247,9 +248,6 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
|
|
|
|
|
|
return rtc;
|
|
return rtc;
|
|
|
|
|
|
-exit_kfree:
|
|
|
|
- kfree(rtc);
|
|
|
|
-
|
|
|
|
exit_ida:
|
|
exit_ida:
|
|
ida_simple_remove(&rtc_ida, id);
|
|
ida_simple_remove(&rtc_ida, id);
|
|
|
|
|