Skip to content

Commit

Permalink
sysfs: Removed dup_name entirely in sysfs_rename
Browse files Browse the repository at this point in the history
Since no one using "dup_name", removed it completely in sysfs_rename.

Signed-off-by: Sasikantha babu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Sasikantha babu authored and gregkh committed May 2, 2012
1 parent eb15742 commit b4eafca
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/sysfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand All @@ -895,7 +894,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
error = 0;
out:
mutex_unlock(&sysfs_mutex);
kfree(dup_name);
return error;
}

Expand Down

0 comments on commit b4eafca

Please sign in to comment.