Commit f7506536 authored by Mariusz Kozlowski's avatar Mariusz Kozlowski Committed by Greg Kroah-Hartman

sysfs: kobject_put cleanup

This patch removes redundant argument checks for kobject_put().
Signed-off-by: default avatarMariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d3fc373a
...@@ -147,7 +147,7 @@ static int open(struct inode * inode, struct file * file) ...@@ -147,7 +147,7 @@ static int open(struct inode * inode, struct file * file)
Error: Error:
module_put(attr->attr.owner); module_put(attr->attr.owner);
Done: Done:
if (error && kobj) if (error)
kobject_put(kobj); kobject_put(kobj);
return error; return error;
} }
...@@ -158,7 +158,6 @@ static int release(struct inode * inode, struct file * file) ...@@ -158,7 +158,6 @@ static int release(struct inode * inode, struct file * file)
struct bin_attribute * attr = to_bin_attr(file->f_path.dentry); struct bin_attribute * attr = to_bin_attr(file->f_path.dentry);
u8 * buffer = file->private_data; u8 * buffer = file->private_data;
if (kobj)
kobject_put(kobj); kobject_put(kobj);
module_put(attr->attr.owner); module_put(attr->attr.owner);
kfree(buffer); kfree(buffer);
......
...@@ -361,7 +361,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) ...@@ -361,7 +361,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
error = -EACCES; error = -EACCES;
module_put(attr->owner); module_put(attr->owner);
Done: Done:
if (error && kobj) if (error)
kobject_put(kobj); kobject_put(kobj);
return error; return error;
} }
...@@ -375,7 +375,6 @@ static int sysfs_release(struct inode * inode, struct file * filp) ...@@ -375,7 +375,6 @@ static int sysfs_release(struct inode * inode, struct file * filp)
if (buffer) if (buffer)
remove_from_collection(buffer, inode); remove_from_collection(buffer, inode);
if (kobj)
kobject_put(kobj); kobject_put(kobj);
/* After this point, attr should not be accessed. */ /* After this point, attr should not be accessed. */
module_put(owner); module_put(owner);
......
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