Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1487491 > unrolled thread

[PATCH] debugfs: remove unused variable

Started byEric Engestrom <eric.engestrom@imgtec.com>
First post2016-09-20 18:20 +0200
Last post2016-09-21 11:30 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] debugfs: remove unused variable Eric Engestrom <eric.engestrom@imgtec.com> - 2016-09-20 18:20 +0200
    Re: [PATCH] debugfs: remove unused variable Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-09-21 10:10 +0200
      Re: [PATCH] debugfs: remove unused variable Eric Engestrom <eric.engestrom@imgtec.com> - 2016-09-21 10:40 +0200
      [PATCH] debugfs: propagate release() call result Eric Engestrom <eric.engestrom@imgtec.com> - 2016-09-21 10:40 +0200
        Re: [PATCH] debugfs: propagate release() call result Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-09-21 11:20 +0200
          [PATCH v2] debugfs: propagate release() call result Eric Engestrom <eric.engestrom@imgtec.com> - 2016-09-21 11:30 +0200
      Re: [PATCH] debugfs: remove unused variable Nicolai Stange <nicstange@gmail.com> - 2016-09-21 11:00 +0200
        Re: [PATCH] debugfs: remove unused variable Eric Engestrom <eric.engestrom@imgtec.com> - 2016-09-21 11:30 +0200

#1487491 — [PATCH] debugfs: remove unused variable

FromEric Engestrom <eric.engestrom@imgtec.com>
Date2016-09-20 18:20 +0200
Subject[PATCH] debugfs: remove unused variable
Message-ID<sjvW1-5lT-7@gated-at.bofh.it>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 fs/debugfs/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 592059f..04eca0b 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -195,7 +195,6 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
 	const struct dentry *dentry = F_DENTRY(filp);
 	const struct file_operations *real_fops = REAL_FOPS_DEREF(dentry);
 	const struct file_operations *proxy_fops = filp->f_op;
-	int r = 0;
 
 	/*
 	 * We must not protect this against removal races here: the
@@ -204,7 +203,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
 	 * ->i_private is still being meaningful here.
 	 */
 	if (real_fops->release)
-		r = real_fops->release(inode, filp);
+		real_fops->release(inode, filp);
 
 	replace_fops(filp, d_inode(dentry)->i_fop);
 	kfree((void *)proxy_fops);
-- 
Cheers,
  Eric

[toc] | [next] | [standalone]


#1487892

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-09-21 10:10 +0200
Message-ID<sjKLo-6u9-15@gated-at.bofh.it>
In reply to#1487491
On Tue, Sep 20, 2016 at 05:17:15PM +0100, Eric Engestrom wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
>  fs/debugfs/file.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index 592059f..04eca0b 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -195,7 +195,6 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
>  	const struct dentry *dentry = F_DENTRY(filp);
>  	const struct file_operations *real_fops = REAL_FOPS_DEREF(dentry);
>  	const struct file_operations *proxy_fops = filp->f_op;
> -	int r = 0;
>  
>  	/*
>  	 * We must not protect this against removal races here: the
> @@ -204,7 +203,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
>  	 * ->i_private is still being meaningful here.
>  	 */
>  	if (real_fops->release)
> -		r = real_fops->release(inode, filp);
> +		real_fops->release(inode, filp);

Hm, shouldn't we be propagating the result back up the call chain?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1487909

FromEric Engestrom <eric.engestrom@imgtec.com>
Date2016-09-21 10:40 +0200
Message-ID<sjLep-6FB-13@gated-at.bofh.it>
In reply to#1487892
On Wed, Sep 21, 2016 at 10:01:11AM +0200, Greg Kroah-Hartman wrote:
> On Tue, Sep 20, 2016 at 05:17:15PM +0100, Eric Engestrom wrote:
> > Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> > ---
> >  fs/debugfs/file.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> > index 592059f..04eca0b 100644
> > --- a/fs/debugfs/file.c
> > +++ b/fs/debugfs/file.c
> > @@ -195,7 +195,6 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
> >  	const struct dentry *dentry = F_DENTRY(filp);
> >  	const struct file_operations *real_fops = REAL_FOPS_DEREF(dentry);
> >  	const struct file_operations *proxy_fops = filp->f_op;
> > -	int r = 0;
> >  
> >  	/*
> >  	 * We must not protect this against removal races here: the
> > @@ -204,7 +203,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
> >  	 * ->i_private is still being meaningful here.
> >  	 */
> >  	if (real_fops->release)
> > -		r = real_fops->release(inode, filp);
> > +		real_fops->release(inode, filp);
> 
> Hm, shouldn't we be propagating the result back up the call chain?

You're right, sorry, I wasn't thinking. Correct fix incoming :)

Cheers,
  Eric

> 
> thanks,
> 
> greg k-h

[toc] | [prev] | [next] | [standalone]


#1487912 — [PATCH] debugfs: propagate release() call result

FromEric Engestrom <eric.engestrom@imgtec.com>
Date2016-09-21 10:40 +0200
Subject[PATCH] debugfs: propagate release() call result
Message-ID<sjLep-6FB-17@gated-at.bofh.it>
In reply to#1487892
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 fs/debugfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 592059f..40e586f 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -209,7 +209,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
 	replace_fops(filp, d_inode(dentry)->i_fop);
 	kfree((void *)proxy_fops);
 	fops_put(real_fops);
-	return 0;
+	return r;
 }
 
 static void __full_proxy_fops_init(struct file_operations *proxy_fops,
-- 
Cheers,
  Eric

[toc] | [prev] | [next] | [standalone]


#1487938 — Re: [PATCH] debugfs: propagate release() call result

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-09-21 11:20 +0200
SubjectRe: [PATCH] debugfs: propagate release() call result
Message-ID<sjLR8-78t-21@gated-at.bofh.it>
In reply to#1487912
On Wed, Sep 21, 2016 at 09:36:53AM +0100, Eric Engestrom wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>

Oops, I can't take patches without any changelog text at all.

Please fix up and resend.

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1487943 — [PATCH v2] debugfs: propagate release() call result

FromEric Engestrom <eric.engestrom@imgtec.com>
Date2016-09-21 11:30 +0200
Subject[PATCH v2] debugfs: propagate release() call result
Message-ID<sjM0N-7bE-11@gated-at.bofh.it>
In reply to#1487938
The result was being ignored and 0 was always returned.
Return the actual result instead.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
v2: add a commit message
---
 fs/debugfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 592059f..40e586f 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -209,7 +209,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
 	replace_fops(filp, d_inode(dentry)->i_fop);
 	kfree((void *)proxy_fops);
 	fops_put(real_fops);
-	return 0;
+	return r;
 }
 
 static void __full_proxy_fops_init(struct file_operations *proxy_fops,
-- 
Cheers,
  Eric

[toc] | [prev] | [next] | [standalone]


#1487920

FromNicolai Stange <nicstange@gmail.com>
Date2016-09-21 11:00 +0200
Message-ID<sjLxM-6M9-17@gated-at.bofh.it>
In reply to#1487892
Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> On Tue, Sep 20, 2016 at 05:17:15PM +0100, Eric Engestrom wrote:
>> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
>> ---
>>  fs/debugfs/file.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
>> index 592059f..04eca0b 100644
>> --- a/fs/debugfs/file.c
>> +++ b/fs/debugfs/file.c
>> @@ -195,7 +195,6 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
>>  	const struct dentry *dentry = F_DENTRY(filp);
>>  	const struct file_operations *real_fops = REAL_FOPS_DEREF(dentry);
>>  	const struct file_operations *proxy_fops = filp->f_op;
>> -	int r = 0;
>>  
>>  	/*
>>  	 * We must not protect this against removal races here: the
>> @@ -204,7 +203,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
>>  	 * ->i_private is still being meaningful here.
>>  	 */
>>  	if (real_fops->release)
>> -		r = real_fops->release(inode, filp);
>> +		real_fops->release(inode, filp);
>
> Hm, shouldn't we be propagating the result back up the call chain?

AFAICS, the VFS layer doesn't ever evaluate the return value of
->release(), c.f. __fput() in fs/file_table.c .

OTOH, propagating that value back to caller also wouldn't hurt. But this
would be a matter of taste/coding style.


I can't remember whether I left this unused int r there on purpose. I
doubt not. Eric, did you run your patch through sparse and Coccinelle?

If so,

  Reviewed-by: Nicolai Stange <nicstange@gmail.com>

for the diff. (This patch lacks a description though.)


Thanks,

Nicolai

[toc] | [prev] | [next] | [standalone]


#1487944

FromEric Engestrom <eric.engestrom@imgtec.com>
Date2016-09-21 11:30 +0200
Message-ID<sjM0N-7bE-17@gated-at.bofh.it>
In reply to#1487920
On Wed, Sep 21, 2016 at 10:50:38AM +0200, Nicolai Stange wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > On Tue, Sep 20, 2016 at 05:17:15PM +0100, Eric Engestrom wrote:
> >> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> >> ---
> >>  fs/debugfs/file.c | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >> 
> >> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> >> index 592059f..04eca0b 100644
> >> --- a/fs/debugfs/file.c
> >> +++ b/fs/debugfs/file.c
> >> @@ -195,7 +195,6 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
> >>  	const struct dentry *dentry = F_DENTRY(filp);
> >>  	const struct file_operations *real_fops = REAL_FOPS_DEREF(dentry);
> >>  	const struct file_operations *proxy_fops = filp->f_op;
> >> -	int r = 0;
> >>  
> >>  	/*
> >>  	 * We must not protect this against removal races here: the
> >> @@ -204,7 +203,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
> >>  	 * ->i_private is still being meaningful here.
> >>  	 */
> >>  	if (real_fops->release)
> >> -		r = real_fops->release(inode, filp);
> >> +		real_fops->release(inode, filp);
> >
> > Hm, shouldn't we be propagating the result back up the call chain?
> 
> AFAICS, the VFS layer doesn't ever evaluate the return value of
> ->release(), c.f. __fput() in fs/file_table.c .
> 
> OTOH, propagating that value back to caller also wouldn't hurt. But this
> would be a matter of taste/coding style.

I actually sent an updated fix [1] about an hour ago, which propagates
the result instead (which is better IMO, I don't know why I didn't do
that the first time around).

[1] http://marc.info/?m=147444718118891  (lkml.org is down?)

> 
> I can't remember whether I left this unused int r there on purpose. I
> doubt not. Eric, did you run your patch through sparse and Coccinelle?

I didn't; how do I do that?  I know these tools, but not how to use them
in this context.

Cheers,
  Eric

> 
> If so,
> 
>   Reviewed-by: Nicolai Stange <nicstange@gmail.com>
> 
> for the diff. (This patch lacks a description though.)
> 
> 
> Thanks,
> 
> Nicolai

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web