]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
sysfs: Removed dup_name entirely in sysfs_rename
authorSasikantha babu <sasikanth.v19@gmail.com>
Wed, 2 May 2012 20:56:14 +0000 (02:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 May 2012 21:55:09 +0000 (14:55 -0700)
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>
fs/sysfs/dir.c

index 35a36d39fa2cb2af62616918872706794a20d8e1..24fa995f03121798c47789cce79d988aecba71f5 100644 (file)
@@ -858,7 +858,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
        struct sysfs_dirent *new_parent_sd, const void *new_ns,
        const char *new_name)
 {
-       const char *dup_name = NULL;
        int error;
 
        mutex_lock(&sysfs_mutex);
@@ -875,11 +874,11 @@ int sysfs_rename(struct sysfs_dirent *sd,
        /* rename sysfs_dirent */
        if (strcmp(sd->s_name, new_name) != 0) {
                error = -ENOMEM;
-               new_name = dup_name = kstrdup(new_name, GFP_KERNEL);
+               new_name = kstrdup(new_name, GFP_KERNEL);
                if (!new_name)
                        goto out;
 
-               dup_name = sd->s_name;
+               kfree(sd->s_name);
                sd->s_name = new_name;
        }
 
@@ -895,7 +894,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
        error = 0;
  out:
        mutex_unlock(&sysfs_mutex);
-       kfree(dup_name);
        return error;
 }