Skip to contentSkip to conversation

cifs: remove redundant variable assignment

PATCH In review Bharath SM 2 participants 3 messages Mar 13, 2024 – Mar 14, 2024

Subsystems (2)
lore
Share & tools
lore

Bharath SM

author
#0 lore raw

PATCH 1/1 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.

---
 fs/smb/client/inode.c | 2 --
 1 file changed, 2 deletions(-)
fs/smb/client/inode.c +0 -2
index 00aae4515a09..50e939234a8e 100644
@@ -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:
Signature · 1 line
2.34.1
#1 lore raw

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);
Quoted 33 lines · Bharath SM

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.

---
 fs/smb/client/inode.c | 2 --
 1 file changed, 2 deletions(-)
fs/smb/client/inode.c +0 -3
index 00aae4515a09..50e939234a8e 100644
@@ -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

Signature · 3 lines
Thanks,

Steve
author
#2 lore raw

Thanks for pointing it out. Updated patch.

Quoted 72 lines · Steve French

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);
Quoted 31 lines · Bharath SM

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.

---
 fs/smb/client/inode.c | 2 --
 1 file changed, 2 deletions(-)
fs/smb/client/inode.c +0 -3
index 00aae4515a09..50e939234a8e 100644
@@ -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:
--
Quoted 2 lines

2.34.1

--
Thanks,

Quoted 1 line

Steve

From a9ff96e6a1495129aab0bb08325f5804c030eb6f Mon Sep 17 00:00:00 2001
From: Bharath SM <[email protected]>
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.

---
 fs/smb/client/inode.c | 2 --
 1 file changed, 2 deletions(-)
fs/smb/client/inode.c +0 -2
index 6092729bf7f6..d28ab0af6049 100644
@@ -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:
Signature · 1 line
2.34.1