From: Geliang Tang Date: Sat, 7 Nov 2015 04:00:21 +0000 (+0800) Subject: rtc: fix module reference count in rtc-proc X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b01079be449b895913ce17a47933820af708d5dd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git rtc: fix module reference count in rtc-proc rtc-proc.c is not built as a module. Thus, rather than dealing with THIS_MODULE's reference count, we should deal with rtc->owner's reference count. Signed-off-by: Geliang Tang Signed-off-by: Alexandre Belloni --- diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index ffa69e1c9245..31e7e23cc5be 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c @@ -112,19 +112,21 @@ static int rtc_proc_open(struct inode *inode, struct file *file) int ret; struct rtc_device *rtc = PDE_DATA(inode); - if (!try_module_get(THIS_MODULE)) + if (!try_module_get(rtc->owner)) return -ENODEV; ret = single_open(file, rtc_proc_show, rtc); if (ret) - module_put(THIS_MODULE); + module_put(rtc->owner); return ret; } static int rtc_proc_release(struct inode *inode, struct file *file) { int res = single_release(inode, file); - module_put(THIS_MODULE); + struct rtc_device *rtc = PDE_DATA(inode); + + module_put(rtc->owner); return res; }