提交 b4eafca1 编写于 作者: S Sasikantha babu 提交者: Greg Kroah-Hartman

sysfs: Removed dup_name entirely in sysfs_rename

Since no one using "dup_name", removed it completely in sysfs_rename.
Signed-off-by: NSasikantha babu <sasikanth.v19@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 eb157427
...@@ -858,7 +858,6 @@ int sysfs_rename(struct sysfs_dirent *sd, ...@@ -858,7 +858,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
struct sysfs_dirent *new_parent_sd, const void *new_ns, struct sysfs_dirent *new_parent_sd, const void *new_ns,
const char *new_name) const char *new_name)
{ {
const char *dup_name = NULL;
int error; int error;
mutex_lock(&sysfs_mutex); mutex_lock(&sysfs_mutex);
...@@ -875,11 +874,11 @@ int sysfs_rename(struct sysfs_dirent *sd, ...@@ -875,11 +874,11 @@ int sysfs_rename(struct sysfs_dirent *sd,
/* rename sysfs_dirent */ /* rename sysfs_dirent */
if (strcmp(sd->s_name, new_name) != 0) { if (strcmp(sd->s_name, new_name) != 0) {
error = -ENOMEM; error = -ENOMEM;
new_name = dup_name = kstrdup(new_name, GFP_KERNEL); new_name = kstrdup(new_name, GFP_KERNEL);
if (!new_name) if (!new_name)
goto out; goto out;
dup_name = sd->s_name; kfree(sd->s_name);
sd->s_name = new_name; sd->s_name = new_name;
} }
...@@ -895,7 +894,6 @@ int sysfs_rename(struct sysfs_dirent *sd, ...@@ -895,7 +894,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
error = 0; error = 0;
out: out:
mutex_unlock(&sysfs_mutex); mutex_unlock(&sysfs_mutex);
kfree(dup_name);
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册