linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: remove redundant variable assignment
@ 2024-03-13 15:00 Bharath SM
  2024-03-14  2:49 ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Bharath SM @ 2024-03-13 15:00 UTC (permalink / raw)
  To: smfrench, linux-cifs, bharathsm

This removes an unnecessary variable assignment. The assigned
value will be overwritten by cifs_fattr_to_inode before it
is accessed, making the line redundant.

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
---
 fs/smb/client/inode.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 00aae4515a09..50e939234a8e 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -400,7 +400,6 @@ cifs_get_file_info_unix(struct file *filp)
 		cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb);
 	} else if (rc == -EREMOTE) {
 		cifs_create_junction_fattr(&fattr, inode->i_sb);
-		rc = 0;
 	} else
 		goto cifs_gfiunix_out;
 
@@ -852,7 +851,6 @@ cifs_get_file_info(struct file *filp)
 		 * for now, just skip revalidating and mark inode for
 		 * immediate reval.
 		 */
-		rc = 0;
 		CIFS_I(inode)->time = 0;
 		goto cgfi_exit;
 	default:
-- 
2.34.1


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

* Re: [PATCH] cifs: remove redundant variable assignment
  2024-03-13 15:00 [PATCH] cifs: remove redundant variable assignment Bharath SM
@ 2024-03-14  2:49 ` Steve French
  2024-03-14 18:14   ` Bharath SM
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2024-03-14  2:49 UTC (permalink / raw)
  To: Bharath SM; +Cc: linux-cifs, bharathsm

The second change in this looks a few lines off (didn't you mean to
remove the rc = 0 nine lines earlier, ie the one from the EREMOTE not
the EINVAL calse?).  See below:

        case -EREMOTE:
                cifs_create_junction_fattr(&fattr, inode->i_sb);
                rc = 0;   /* FIX: shouldn't you remove this one */
                break;
        case -EOPNOTSUPP:
        case -EINVAL:
                /*
                 * FIXME: legacy server -- fall back to path-based call?
                 * for now, just skip revalidating and mark inode for
                 * immediate reval.
                 */
-               rc = 0;   /* FIX: and not remove this one ? */
                CIFS_I(inode)->time = 0;
                goto cgfi_exit;
        default:
                goto cgfi_exit;
        }

        /*
         * don't bother with SFU junk here -- just mark inode as needing
         * revalidation.
         */
        fattr.cf_uniqueid = CIFS_I(inode)->uniqueid;
        fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
        /* if filetype is different, return error */
        rc = cifs_fattr_to_inode(inode, &fattr, false);


On Wed, Mar 13, 2024 at 10:01 AM Bharath SM <bharathsm.hsk@gmail.com> wrote:
>
> This removes an unnecessary variable assignment. The assigned
> value will be overwritten by cifs_fattr_to_inode before it
> is accessed, making the line redundant.
>
> Signed-off-by: Bharath SM <bharathsm@microsoft.com>
> ---
>  fs/smb/client/inode.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> index 00aae4515a09..50e939234a8e 100644
> --- a/fs/smb/client/inode.c
> +++ b/fs/smb/client/inode.c
> @@ -400,7 +400,6 @@ cifs_get_file_info_unix(struct file *filp)
>                 cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb);
>         } else if (rc == -EREMOTE) {
>                 cifs_create_junction_fattr(&fattr, inode->i_sb);
> -               rc = 0;
>         } else
>                 goto cifs_gfiunix_out;
>
> @@ -852,7 +851,6 @@ cifs_get_file_info(struct file *filp)
>                  * for now, just skip revalidating and mark inode for
>                  * immediate reval.
>                  */
> -               rc = 0;
>                 CIFS_I(inode)->time = 0;
>                 goto cgfi_exit;
>         default:
> --
> 2.34.1
>


-- 
Thanks,

Steve

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

* Re: [PATCH] cifs: remove redundant variable assignment
  2024-03-14  2:49 ` Steve French
@ 2024-03-14 18:14   ` Bharath SM
  0 siblings, 0 replies; 3+ messages in thread
From: Bharath SM @ 2024-03-14 18:14 UTC (permalink / raw)
  To: Steve French; +Cc: linux-cifs, bharathsm

[-- Attachment #1: Type: text/plain, Size: 2700 bytes --]

Thanks for pointing it out. Updated patch.

On Thu, Mar 14, 2024 at 8:19 AM Steve French <smfrench@gmail.com> wrote:
>
> The second change in this looks a few lines off (didn't you mean to
> remove the rc = 0 nine lines earlier, ie the one from the EREMOTE not
> the EINVAL calse?).  See below:
>
>         case -EREMOTE:
>                 cifs_create_junction_fattr(&fattr, inode->i_sb);
>                 rc = 0;   /* FIX: shouldn't you remove this one */
>                 break;
>         case -EOPNOTSUPP:
>         case -EINVAL:
>                 /*
>                  * FIXME: legacy server -- fall back to path-based call?
>                  * for now, just skip revalidating and mark inode for
>                  * immediate reval.
>                  */
> -               rc = 0;   /* FIX: and not remove this one ? */
>                 CIFS_I(inode)->time = 0;
>                 goto cgfi_exit;
>         default:
>                 goto cgfi_exit;
>         }
>
>         /*
>          * don't bother with SFU junk here -- just mark inode as needing
>          * revalidation.
>          */
>         fattr.cf_uniqueid = CIFS_I(inode)->uniqueid;
>         fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
>         /* if filetype is different, return error */
>         rc = cifs_fattr_to_inode(inode, &fattr, false);
>
>
> On Wed, Mar 13, 2024 at 10:01 AM Bharath SM <bharathsm.hsk@gmail.com> wrote:
> >
> > This removes an unnecessary variable assignment. The assigned
> > value will be overwritten by cifs_fattr_to_inode before it
> > is accessed, making the line redundant.
> >
> > Signed-off-by: Bharath SM <bharathsm@microsoft.com>
> > ---
> >  fs/smb/client/inode.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> > index 00aae4515a09..50e939234a8e 100644
> > --- a/fs/smb/client/inode.c
> > +++ b/fs/smb/client/inode.c
> > @@ -400,7 +400,6 @@ cifs_get_file_info_unix(struct file *filp)
> >                 cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb);
> >         } else if (rc == -EREMOTE) {
> >                 cifs_create_junction_fattr(&fattr, inode->i_sb);
> > -               rc = 0;
> >         } else
> >                 goto cifs_gfiunix_out;
> >
> > @@ -852,7 +851,6 @@ cifs_get_file_info(struct file *filp)
> >                  * for now, just skip revalidating and mark inode for
> >                  * immediate reval.
> >                  */
> > -               rc = 0;
> >                 CIFS_I(inode)->time = 0;
> >                 goto cgfi_exit;
> >         default:
> > --
> > 2.34.1
> >
>
>
> --
> Thanks,
>
> Steve

[-- Attachment #2: 0001-cifs-remove-redundant-variable-assignment.patch --]
[-- Type: application/octet-stream, Size: 1107 bytes --]

From a9ff96e6a1495129aab0bb08325f5804c030eb6f Mon Sep 17 00:00:00 2001
From: Bharath SM <bharathsm@microsoft.com>
Date: Thu, 14 Mar 2024 23:36:36 +0530
Subject: [PATCH] cifs: remove redundant variable assignment

This removes an unnecessary variable assignment. The assigned
value will be overwritten by cifs_fattr_to_inode before it
is accessed, making the line redundant.

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
---
 fs/smb/client/inode.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 6092729bf7f6..d28ab0af6049 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -401,7 +401,6 @@ cifs_get_file_info_unix(struct file *filp)
 		cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb);
 	} else if (rc == -EREMOTE) {
 		cifs_create_junction_fattr(&fattr, inode->i_sb);
-		rc = 0;
 	} else
 		goto cifs_gfiunix_out;
 
@@ -846,7 +845,6 @@ cifs_get_file_info(struct file *filp)
 		break;
 	case -EREMOTE:
 		cifs_create_junction_fattr(&fattr, inode->i_sb);
-		rc = 0;
 		break;
 	case -EOPNOTSUPP:
 	case -EINVAL:
-- 
2.34.1


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

end of thread, other threads:[~2024-03-14 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 15:00 [PATCH] cifs: remove redundant variable assignment Bharath SM
2024-03-14  2:49 ` Steve French
2024-03-14 18:14   ` Bharath SM

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).