Commit c3b399a4 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Alexandre Belloni

rtc: class: remove unnecessary device_get() in rtc_device_unregister

Technically the address of rtc->dev can never be NULL, so get_device()
can never fail. Also caller of rtc_device_unregister() supposed to be
the owner of the device and thus have a valid reference. Therefore
call to get_device() is not needed here.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 6706664d
...@@ -266,19 +266,18 @@ EXPORT_SYMBOL_GPL(rtc_device_register); ...@@ -266,19 +266,18 @@ EXPORT_SYMBOL_GPL(rtc_device_register);
*/ */
void rtc_device_unregister(struct rtc_device *rtc) void rtc_device_unregister(struct rtc_device *rtc)
{ {
if (get_device(&rtc->dev) != NULL) { mutex_lock(&rtc->ops_lock);
mutex_lock(&rtc->ops_lock); /*
/* remove innards of this RTC, then disable it, before * Remove innards of this RTC, then disable it, before
* letting any rtc_class_open() users access it again * letting any rtc_class_open() users access it again
*/ */
rtc_sysfs_del_device(rtc); rtc_sysfs_del_device(rtc);
rtc_dev_del_device(rtc); rtc_dev_del_device(rtc);
rtc_proc_del_device(rtc); rtc_proc_del_device(rtc);
device_unregister(&rtc->dev); device_del(&rtc->dev);
rtc->ops = NULL; rtc->ops = NULL;
mutex_unlock(&rtc->ops_lock); mutex_unlock(&rtc->ops_lock);
put_device(&rtc->dev); put_device(&rtc->dev);
}
} }
EXPORT_SYMBOL_GPL(rtc_device_unregister); EXPORT_SYMBOL_GPL(rtc_device_unregister);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment