[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <558D52C0.7080109@users.sourceforge.net>
Date: Fri, 26 Jun 2015 15:25:20 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Joel Becker <jlbec@...lplan.org>, kernel-janitors@...r.kernel.org
CC: LKML <linux-kernel@...r.kernel.org>,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH] configfs: Delete unnecessary checks before the function call
"config_item_put"
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 26 Jun 2015 15:20:43 +0200
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@...rs.sourceforge.net>
---
fs/configfs/file.c | 5 ++---
fs/configfs/item.c | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 403269f..c70997f 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -274,7 +274,7 @@ static int check_perm(struct inode * inode, struct file * file)
Enomem:
module_put(attr->ca_owner);
Done:
- if (error && item)
+ if (error)
config_item_put(item);
return error;
}
@@ -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 4d6a30e..6173fa7 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -152,8 +152,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.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists