diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/bin.c | 5 | ||||
-rw-r--r-- | fs/sysfs/file.c | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 9ec1c8539a5d..d3b9f5f07db1 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -147,7 +147,7 @@ static int open(struct inode * inode, struct file * file) | |||
147 | Error: | 147 | Error: |
148 | module_put(attr->attr.owner); | 148 | module_put(attr->attr.owner); |
149 | Done: | 149 | Done: |
150 | if (error && kobj) | 150 | if (error) |
151 | kobject_put(kobj); | 151 | kobject_put(kobj); |
152 | return error; | 152 | return error; |
153 | } | 153 | } |
@@ -158,8 +158,7 @@ static int release(struct inode * inode, struct file * file) | |||
158 | struct bin_attribute * attr = to_bin_attr(file->f_path.dentry); | 158 | struct bin_attribute * attr = to_bin_attr(file->f_path.dentry); |
159 | u8 * buffer = file->private_data; | 159 | u8 * buffer = file->private_data; |
160 | 160 | ||
161 | if (kobj) | 161 | kobject_put(kobj); |
162 | kobject_put(kobj); | ||
163 | module_put(attr->attr.owner); | 162 | module_put(attr->attr.owner); |
164 | kfree(buffer); | 163 | kfree(buffer); |
165 | return 0; | 164 | return 0; |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index cba4c1c7383c..46618f81ae48 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -361,7 +361,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) | |||
361 | error = -EACCES; | 361 | error = -EACCES; |
362 | module_put(attr->owner); | 362 | module_put(attr->owner); |
363 | Done: | 363 | Done: |
364 | if (error && kobj) | 364 | if (error) |
365 | kobject_put(kobj); | 365 | kobject_put(kobj); |
366 | return error; | 366 | return error; |
367 | } | 367 | } |
@@ -375,8 +375,7 @@ static int sysfs_release(struct inode * inode, struct file * filp) | |||
375 | 375 | ||
376 | if (buffer) | 376 | if (buffer) |
377 | remove_from_collection(buffer, inode); | 377 | remove_from_collection(buffer, inode); |
378 | if (kobj) | 378 | kobject_put(kobj); |
379 | kobject_put(kobj); | ||
380 | /* After this point, attr should not be accessed. */ | 379 | /* After this point, attr should not be accessed. */ |
381 | module_put(owner); | 380 | module_put(owner); |
382 | 381 | ||