public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sysfs: Redundant assignment of dup_name in sysfs_rename
@ 2012-04-27 14:31 Sasikantha babu
  2012-04-30  1:55 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Sasikantha babu @ 2012-04-27 14:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sasikantha babu

It is redundant to assign "kstrdup" of "new_value" to "dup_name",
Since we are overwriting "dup_name" with "sd->s_name"

Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
 fs/sysfs/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 35a36d3..4abd424 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -875,7 +875,7 @@ 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;
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sysfs: Redundant assignment of dup_name in sysfs_rename
  2012-04-27 14:31 [PATCH] sysfs: Redundant assignment of dup_name in sysfs_rename Sasikantha babu
@ 2012-04-30  1:55 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2012-04-30  1:55 UTC (permalink / raw)
  To: Sasikantha babu; +Cc: linux-kernel

On Fri, Apr 27, 2012 at 08:01:02PM +0530, Sasikantha babu wrote:
> It is redundant to assign "kstrdup" of "new_value" to "dup_name",
> Since we are overwriting "dup_name" with "sd->s_name"
> 
> Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
> ---
>  fs/sysfs/dir.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index 35a36d3..4abd424 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -875,7 +875,7 @@ 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;

Why not get rid of dup_name entirely now as it really isn't used at all?
That would make a more "complete" patch, care to redo this?

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-30  5:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 14:31 [PATCH] sysfs: Redundant assignment of dup_name in sysfs_rename Sasikantha babu
2012-04-30  1:55 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox