All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH 1/2] rtc: fix module reference count in rtc-proc
@ 2015-11-07  4:00 ` Geliang Tang
  0 siblings, 0 replies; 8+ messages in thread
From: Geliang Tang @ 2015-11-07  4:00 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Geliang Tang, rtc-linux, linux-kernel

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 <geliangtang@163.com>
---
 drivers/rtc/rtc-proc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index ffa69e1..31e7e23 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;
 }
 
-- 
2.5.0


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-30 19:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-07  4:00 [rtc-linux] [PATCH 1/2] rtc: fix module reference count in rtc-proc Geliang Tang
2015-11-07  4:00 ` Geliang Tang
2015-11-07  4:00 ` [rtc-linux] [PATCH 2/2] rtc: efi: add efi_procfs in efi_rtc_ops Geliang Tang
2015-11-07  4:00   ` Geliang Tang
2015-11-25  0:05   ` [rtc-linux] " Alexandre Belloni
2015-11-25  0:05     ` Alexandre Belloni
2015-11-30 19:03 ` [rtc-linux] Re: [PATCH 1/2] rtc: fix module reference count in rtc-proc Alexandre Belloni
2015-11-30 19:03   ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.