* [patch] proc: cleanup: remove unused assignments
@ 2010-03-06 11:19 Dan Carpenter
2010-03-07 19:55 ` Oleg Nesterov
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2010-03-06 11:19 UTC (permalink / raw)
To: akpm
Cc: Al Viro, KOSAKI Motohiro, James Morris, Oleg Nesterov,
Sukadev Bhattiprolu, Serge Hallyn, Helight.Xu, linux-kernel
I removed 3 unused assignments. The first two get reset on the first
statement of their functions. For "err" in root.c we don't return an
error and we don't use the variable again.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a731084..875d636 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
const struct pid_entry *p = ptr;
struct inode *inode;
struct proc_inode *ei;
- struct dentry *error = ERR_PTR(-EINVAL);
+ struct dentry *error;
/* Allocate the inode */
error = ERR_PTR(-ENOMEM);
@@ -2784,7 +2784,7 @@ out:
struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
{
- struct dentry *result = ERR_PTR(-ENOENT);
+ struct dentry *result;
struct task_struct *task;
unsigned tgid;
struct pid_namespace *ns;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 757c069..4258384 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -110,7 +110,6 @@ void __init proc_root_init(void)
if (err)
return;
proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
- err = PTR_ERR(proc_mnt);
if (IS_ERR(proc_mnt)) {
unregister_filesystem(&proc_fs_type);
return;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch] proc: cleanup: remove unused assignments
2010-03-06 11:19 [patch] proc: cleanup: remove unused assignments Dan Carpenter
@ 2010-03-07 19:55 ` Oleg Nesterov
2010-03-08 4:13 ` Serge E. Hallyn
2010-03-09 3:25 ` KOSAKI Motohiro
2010-03-11 10:17 ` Helight.Xu
2 siblings, 1 reply; 6+ messages in thread
From: Oleg Nesterov @ 2010-03-07 19:55 UTC (permalink / raw)
To: Dan Carpenter, akpm, Al Viro, KOSAKI Motohiro, James Morris,
Sukadev Bhattiprolu, Serge Hallyn, Helight.Xu, linux-kernel
On 03/06, Dan Carpenter wrote:
>
> I removed 3 unused assignments. The first two get reset on the first
> statement of their functions. For "err" in root.c we don't return an
> error and we don't use the variable again.
Looks like the obviously nice cleanup to me.
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index a731084..875d636 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
> const struct pid_entry *p = ptr;
> struct inode *inode;
> struct proc_inode *ei;
> - struct dentry *error = ERR_PTR(-EINVAL);
> + struct dentry *error;
>
> /* Allocate the inode */
> error = ERR_PTR(-ENOMEM);
> @@ -2784,7 +2784,7 @@ out:
>
> struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
> {
> - struct dentry *result = ERR_PTR(-ENOENT);
> + struct dentry *result;
> struct task_struct *task;
> unsigned tgid;
> struct pid_namespace *ns;
> diff --git a/fs/proc/root.c b/fs/proc/root.c
> index 757c069..4258384 100644
> --- a/fs/proc/root.c
> +++ b/fs/proc/root.c
> @@ -110,7 +110,6 @@ void __init proc_root_init(void)
> if (err)
> return;
> proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
> - err = PTR_ERR(proc_mnt);
> if (IS_ERR(proc_mnt)) {
> unregister_filesystem(&proc_fs_type);
> return;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] proc: cleanup: remove unused assignments
2010-03-07 19:55 ` Oleg Nesterov
@ 2010-03-08 4:13 ` Serge E. Hallyn
0 siblings, 0 replies; 6+ messages in thread
From: Serge E. Hallyn @ 2010-03-08 4:13 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Dan Carpenter, akpm, Al Viro, KOSAKI Motohiro, James Morris,
Sukadev Bhattiprolu, Helight.Xu, linux-kernel
Quoting Oleg Nesterov (oleg@redhat.com):
> On 03/06, Dan Carpenter wrote:
> >
> > I removed 3 unused assignments. The first two get reset on the first
> > statement of their functions. For "err" in root.c we don't return an
> > error and we don't use the variable again.
>
> Looks like the obviously nice cleanup to me.
Yup. Particularly the last one might confuse someone...
Acked-by: Serge Hallyn <serue@us.ibm.com>
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> >
> > diff --git a/fs/proc/base.c b/fs/proc/base.c
> > index a731084..875d636 100644
> > --- a/fs/proc/base.c
> > +++ b/fs/proc/base.c
> > @@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
> > const struct pid_entry *p = ptr;
> > struct inode *inode;
> > struct proc_inode *ei;
> > - struct dentry *error = ERR_PTR(-EINVAL);
> > + struct dentry *error;
> >
> > /* Allocate the inode */
> > error = ERR_PTR(-ENOMEM);
> > @@ -2784,7 +2784,7 @@ out:
> >
> > struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
> > {
> > - struct dentry *result = ERR_PTR(-ENOENT);
> > + struct dentry *result;
> > struct task_struct *task;
> > unsigned tgid;
> > struct pid_namespace *ns;
> > diff --git a/fs/proc/root.c b/fs/proc/root.c
> > index 757c069..4258384 100644
> > --- a/fs/proc/root.c
> > +++ b/fs/proc/root.c
> > @@ -110,7 +110,6 @@ void __init proc_root_init(void)
> > if (err)
> > return;
> > proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
> > - err = PTR_ERR(proc_mnt);
> > if (IS_ERR(proc_mnt)) {
> > unregister_filesystem(&proc_fs_type);
> > return;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] proc: cleanup: remove unused assignments
2010-03-06 11:19 [patch] proc: cleanup: remove unused assignments Dan Carpenter
2010-03-07 19:55 ` Oleg Nesterov
@ 2010-03-09 3:25 ` KOSAKI Motohiro
2010-03-11 10:17 ` Helight.Xu
2 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-03-09 3:25 UTC (permalink / raw)
To: Dan Carpenter, akpm, Al Viro, KOSAKI Motohiro, James Morris,
Oleg Nesterov, Sukadev Bhattiprolu, Serge Hallyn, Helight.Xu,
linux-kernel
Cc: kosaki.motohiro
> I removed 3 unused assignments. The first two get reset on the first
> statement of their functions. For "err" in root.c we don't return an
> error and we don't use the variable again.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Looks good.
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index a731084..875d636 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
> const struct pid_entry *p = ptr;
> struct inode *inode;
> struct proc_inode *ei;
> - struct dentry *error = ERR_PTR(-EINVAL);
> + struct dentry *error;
>
> /* Allocate the inode */
> error = ERR_PTR(-ENOMEM);
> @@ -2784,7 +2784,7 @@ out:
>
> struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
> {
> - struct dentry *result = ERR_PTR(-ENOENT);
> + struct dentry *result;
> struct task_struct *task;
> unsigned tgid;
> struct pid_namespace *ns;
> diff --git a/fs/proc/root.c b/fs/proc/root.c
> index 757c069..4258384 100644
> --- a/fs/proc/root.c
> +++ b/fs/proc/root.c
> @@ -110,7 +110,6 @@ void __init proc_root_init(void)
> if (err)
> return;
> proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
> - err = PTR_ERR(proc_mnt);
> if (IS_ERR(proc_mnt)) {
> unregister_filesystem(&proc_fs_type);
> return;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] proc: cleanup: remove unused assignments
2010-03-06 11:19 [patch] proc: cleanup: remove unused assignments Dan Carpenter
2010-03-07 19:55 ` Oleg Nesterov
2010-03-09 3:25 ` KOSAKI Motohiro
@ 2010-03-11 10:17 ` Helight.Xu
2010-03-11 10:29 ` Dan Carpenter
2 siblings, 1 reply; 6+ messages in thread
From: Helight.Xu @ 2010-03-11 10:17 UTC (permalink / raw)
To: Dan Carpenter, akpm, Al Viro, KOSAKI Motohiro, James Morris,
Oleg Nesterov, Sukadev Bhattiprolu, Serge Hallyn, Helight.Xu,
linux-kernel
Dan Carpenter wrote:
> I removed 3 unused assignments. The first two get reset on the first
> statement of their functions. For "err" in root.c we don't return an
> error and we don't use the variable again.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index a731084..875d636 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
> const struct pid_entry *p = ptr;
> struct inode *inode;
> struct proc_inode *ei;
> - struct dentry *error = ERR_PTR(-EINVAL);
> + struct dentry *error;
>
> /* Allocate the inode */
> error = ERR_PTR(-ENOMEM);
>
why not do it like this:
@@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
const struct pid_entry *p = ptr;
struct inode *inode;
struct proc_inode *ei;
- struct dentry *error = ERR_PTR(-EINVAL);
+ struct dentry *error = ERR_PTR(-ENOMEM);
/* Allocate the inode */
- error = ERR_PTR(-ENOMEM);
> @@ -2784,7 +2784,7 @@ out:
>
> struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
> {
> - struct dentry *result = ERR_PTR(-ENOENT);
> + struct dentry *result;
> struct task_struct *task;
> unsigned tgid;
> struct pid_namespace *ns;
> diff --git a/fs/proc/root.c b/fs/proc/root.c
> index 757c069..4258384 100644
> --- a/fs/proc/root.c
> +++ b/fs/proc/root.c
> @@ -110,7 +110,6 @@ void __init proc_root_init(void)
> if (err)
> return;
> proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
> - err = PTR_ERR(proc_mnt);
> if (IS_ERR(proc_mnt)) {
> unregister_filesystem(&proc_fs_type);
> return;
>
>
--
Zhenwen Xu - Seven Helight
Home Page: http://zhwen.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] proc: cleanup: remove unused assignments
2010-03-11 10:17 ` Helight.Xu
@ 2010-03-11 10:29 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2010-03-11 10:29 UTC (permalink / raw)
To: Helight.Xu
Cc: akpm, Al Viro, KOSAKI Motohiro, James Morris, Oleg Nesterov,
Sukadev Bhattiprolu, Serge Hallyn, linux-kernel
On Thu, Mar 11, 2010 at 06:17:58PM +0800, Helight.Xu wrote:
> Dan Carpenter wrote:
>> I removed 3 unused assignments. The first two get reset on the first
>> statement of their functions. For "err" in root.c we don't return an
>> error and we don't use the variable again.
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
>>
>> diff --git a/fs/proc/base.c b/fs/proc/base.c
>> index a731084..875d636 100644
>> --- a/fs/proc/base.c
>> +++ b/fs/proc/base.c
>> @@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
>> const struct pid_entry *p = ptr;
>> struct inode *inode;
>> struct proc_inode *ei;
>> - struct dentry *error = ERR_PTR(-EINVAL);
>> + struct dentry *error;
>> /* Allocate the inode */
>> error = ERR_PTR(-ENOMEM);
>>
> why not do it like this:
>
> @@ -2434,7 +2434,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
> const struct pid_entry *p = ptr;
> struct inode *inode;
> struct proc_inode *ei;
> - struct dentry *error = ERR_PTR(-EINVAL);
> + struct dentry *error = ERR_PTR(-ENOMEM);
>
> /* Allocate the inode */
> - error = ERR_PTR(-ENOMEM);
>
It's a personal preference. If anyone read the code in initializers, I
wouldn't have had had anything to clean up in the first place. ;)
regards,
dan carpenter
>
>
>> @@ -2784,7 +2784,7 @@ out:
>> struct dentry *proc_pid_lookup(struct inode *dir, struct dentry *
>> dentry, struct nameidata *nd)
>> {
>> - struct dentry *result = ERR_PTR(-ENOENT);
>> + struct dentry *result;
>> struct task_struct *task;
>> unsigned tgid;
>> struct pid_namespace *ns;
>> diff --git a/fs/proc/root.c b/fs/proc/root.c
>> index 757c069..4258384 100644
>> --- a/fs/proc/root.c
>> +++ b/fs/proc/root.c
>> @@ -110,7 +110,6 @@ void __init proc_root_init(void)
>> if (err)
>> return;
>> proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
>> - err = PTR_ERR(proc_mnt);
>> if (IS_ERR(proc_mnt)) {
>> unregister_filesystem(&proc_fs_type);
>> return;
>>
>>
>
>
> --
> Zhenwen Xu - Seven Helight
> Home Page: http://zhwen.org
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-03-11 10:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-06 11:19 [patch] proc: cleanup: remove unused assignments Dan Carpenter
2010-03-07 19:55 ` Oleg Nesterov
2010-03-08 4:13 ` Serge E. Hallyn
2010-03-09 3:25 ` KOSAKI Motohiro
2010-03-11 10:17 ` Helight.Xu
2010-03-11 10:29 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox