From: Mariusz Kozlowski <[email protected]> This patch removes redundant argument checks for kobject_put(). Signed-off-by: Mariusz Kozlowski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- fs/sysfs/bin.c | 5 ++--- 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 9ec1c85..d3b9f5f 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 cba4c1c..46618f8 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); -- 1.4.4.4 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 20/28] kobject: kobject_put cleanup
- From: Greg KH <[email protected]>
- [PATCH 20/28] kobject: kobject_put cleanup
- References:
- [GIT PATCH] Driver core patches for 2.6.20
- From: Greg KH <[email protected]>
- [PATCH 1/28] Kobject: make kobject apis more robust in handling NULL pointers
- From: Greg KH <[email protected]>
- [PATCH 2/28] Driver core: convert pcmcia code to use struct device
- From: Greg KH <[email protected]>
- [PATCH 3/28] Driver core: convert SPI code to use struct device
- From: Greg KH <[email protected]>
- [PATCH 4/28] Network: convert network devices to use struct device instead of class_device
- From: Greg KH <[email protected]>
- [PATCH 5/28] driver core: Remove device_is_registered() in device_move().
- From: Greg KH <[email protected]>
- [PATCH 6/28] driver core: Allow device_move(dev, NULL).
- From: Greg KH <[email protected]>
- [PATCH 7/28] MODULES: add the module name for built in kernel drivers
- From: Greg KH <[email protected]>
- [PATCH 8/28] Modules: only add drivers/ direcory if needed
- From: Greg KH <[email protected]>
- [PATCH 9/28] PCI: add the sysfs driver name to all modules
- From: Greg KH <[email protected]>
- [PATCH 10/28] SERIO: add the sysfs driver name to all modules
- From: Greg KH <[email protected]>
- [PATCH 11/28] USB: add the sysfs driver name to all modules
- From: Greg KH <[email protected]>
- [PATCH 12/28] /sys/modules/*/holders
- From: Greg KH <[email protected]>
- [PATCH 13/28] driver core fixes: make_class_name() retval checks
- From: Greg KH <[email protected]>
- [PATCH 14/28] driver core fixes: device_register() retval check in platform.c
- From: Greg KH <[email protected]>
- [PATCH 15/28] driver core: Don't stop probing on ->probe errors.
- From: Greg KH <[email protected]>
- [PATCH 16/28] driver core: Change function call order in device_bind_driver().
- From: Greg KH <[email protected]>
- [PATCH 17/28] Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()
- From: Greg KH <[email protected]>
- [PATCH 18/28] sysfs: suppress lockdep warnings
- From: Greg KH <[email protected]>
- [GIT PATCH] Driver core patches for 2.6.20
- Prev by Date: [PATCH 20/28] kobject: kobject_put cleanup
- Next by Date: [PATCH 23/28] SYSFS: Fix missing include of list.h in sysfs.h
- Previous by thread: [PATCH 18/28] sysfs: suppress lockdep warnings
- Next by thread: [PATCH 20/28] kobject: kobject_put cleanup
- Index(es):