Skip to content

Commit b4eafca

Browse files
Sasikantha babugregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent eb15742 commit b4eafca

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/sysfs/dir.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
858858
struct sysfs_dirent *new_parent_sd, const void *new_ns,
859859
const char *new_name)
860860
{
861-
const char *dup_name = NULL;
862861
int error;
863862

864863
mutex_lock(&sysfs_mutex);
@@ -875,11 +874,11 @@ int sysfs_rename(struct sysfs_dirent *sd,
875874
/* rename sysfs_dirent */
876875
if (strcmp(sd->s_name, new_name) != 0) {
877876
error = -ENOMEM;
878-
new_name = dup_name = kstrdup(new_name, GFP_KERNEL);
877+
new_name = kstrdup(new_name, GFP_KERNEL);
879878
if (!new_name)
880879
goto out;
881880

882-
dup_name = sd->s_name;
881+
kfree(sd->s_name);
883882
sd->s_name = new_name;
884883
}
885884

@@ -895,7 +894,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
895894
error = 0;
896895
out:
897896
mutex_unlock(&sysfs_mutex);
898-
kfree(dup_name);
899897
return error;
900898
}
901899

0 commit comments

Comments
 (0)