diff options
-rw-r--r-- | drivers/rtc/rtc-proc.c | 8 |
1 files changed, 5 insertions, 3 deletions
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) | |||
112 | int ret; | 112 | int ret; |
113 | struct rtc_device *rtc = PDE_DATA(inode); | 113 | struct rtc_device *rtc = PDE_DATA(inode); |
114 | 114 | ||
115 | if (!try_module_get(THIS_MODULE)) | 115 | if (!try_module_get(rtc->owner)) |
116 | return -ENODEV; | 116 | return -ENODEV; |
117 | 117 | ||
118 | ret = single_open(file, rtc_proc_show, rtc); | 118 | ret = single_open(file, rtc_proc_show, rtc); |
119 | if (ret) | 119 | if (ret) |
120 | module_put(THIS_MODULE); | 120 | module_put(rtc->owner); |
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int rtc_proc_release(struct inode *inode, struct file *file) | 124 | static int rtc_proc_release(struct inode *inode, struct file *file) |
125 | { | 125 | { |
126 | int res = single_release(inode, file); | 126 | int res = single_release(inode, file); |
127 | module_put(THIS_MODULE); | 127 | struct rtc_device *rtc = PDE_DATA(inode); |
128 | |||
129 | module_put(rtc->owner); | ||
128 | return res; | 130 | return res; |
129 | } | 131 | } |
130 | 132 | ||