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

From: SF Markus Elfring
Date: Mon Nov 17 2014 - 13:43:21 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/