aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSasikantha babu <sasikanth.v19@gmail.com>2012-05-02 16:56:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-02 17:55:09 -0400
commitb4eafca1132d6065c2f37a873dbf4e0bb88cb23f (patch)
tree5c4ae4434dadebbbc82954227b4028804ac5797d /fs
parenteb1574270a6de8fb8d31ffc3b021e30df0afcda3 (diff)
sysfs: Removed dup_name entirely in sysfs_rename
Since no one using "dup_name", removed it completely in sysfs_rename. Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/sysfs/dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 35a36d39fa2c..24fa995f0312 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -858,7 +858,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
858 struct sysfs_dirent *new_parent_sd, const void *new_ns, 858 struct sysfs_dirent *new_parent_sd, const void *new_ns,
859 const char *new_name) 859 const char *new_name)
860{ 860{
861 const char *dup_name = NULL;
862 int error; 861 int error;
863 862
864 mutex_lock(&sysfs_mutex); 863 mutex_lock(&sysfs_mutex);
@@ -875,11 +874,11 @@ int sysfs_rename(struct sysfs_dirent *sd,
875 /* rename sysfs_dirent */ 874 /* rename sysfs_dirent */
876 if (strcmp(sd->s_name, new_name) != 0) { 875 if (strcmp(sd->s_name, new_name) != 0) {
877 error = -ENOMEM; 876 error = -ENOMEM;
878 new_name = dup_name = kstrdup(new_name, GFP_KERNEL); 877 new_name = kstrdup(new_name, GFP_KERNEL);
879 if (!new_name) 878 if (!new_name)
880 goto out; 879 goto out;
881 880
882 dup_name = sd->s_name; 881 kfree(sd->s_name);
883 sd->s_name = new_name; 882 sd->s_name = new_name;
884 } 883 }
885 884
@@ -895,7 +894,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
895 error = 0; 894 error = 0;
896 out: 895 out:
897 mutex_unlock(&sysfs_mutex); 896 mutex_unlock(&sysfs_mutex);
898 kfree(dup_name);
899 return error; 897 return error;
900} 898}
901 899