From: Mariusz Kozlowski Date: Tue, 2 Jan 2007 12:41:10 +0000 (+0100) Subject: sysfs: kobject_put cleanup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f75065367077bd3b77842a5aa523ecd05d33e82d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git sysfs: kobject_put cleanup This patch removes redundant argument checks for kobject_put(). Signed-off-by: Mariusz Kozlowski Signed-off-by: Greg Kroah-Hartman --- 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) Error: module_put(attr->attr.owner); Done: - if (error && kobj) + if (error) kobject_put(kobj); return error; } @@ -158,8 +158,7 @@ static int release(struct inode * inode, struct file * file) struct bin_attribute * attr = to_bin_attr(file->f_path.dentry); u8 * buffer = file->private_data; - if (kobj) - kobject_put(kobj); + kobject_put(kobj); module_put(attr->attr.owner); kfree(buffer); 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) error = -EACCES; module_put(attr->owner); Done: - if (error && kobj) + if (error) kobject_put(kobj); return error; } @@ -375,8 +375,7 @@ static int sysfs_release(struct inode * inode, struct file * filp) if (buffer) remove_from_collection(buffer, inode); - if (kobj) - kobject_put(kobj); + kobject_put(kobj); /* After this point, attr should not be accessed. */ module_put(owner);