[PATCH 1/1] configfs: Deletion of unnecessary checks before the function call "config_item_put"

SF Markus Elfring
2014-11-17T18:42:35Z

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 17 Nov 2014 19:37:03 +0100

The config_item_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/configfs/file.c | 3 +--
fs/configfs/item.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 1d1c41f..48f36e7 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -291,8 +291,7 @@ static int configfs_release(struct inode * inode, struct file * filp)
struct module * owner = attr->ca_owner;
struct configfs_buffer * buffer = filp->private_data;

- if (item)
- config_item_put(item);
+ config_item_put(item);
/* After this point, attr should not be accessed. */
module_put(owner);

diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index e65f9ff..891b20e 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -153,8 +153,7 @@ static void config_item_cleanup(struct config_item *item)
t->ct_item_ops->release(item);
if (s)
config_group_put(s);
- if (parent)
- config_item_put(parent);
+ config_item_put(parent);
}

static void config_item_release(struct kref *kref)
--
2.1.3