mm/shmem.c: Clean code by removing unnecessary assignment
Subsystems (2)
PATCH 1/1 mm/shmem.c: Clean code by removing unnecessary assignment
From: Mateusz Nosek <[email protected]>
Previously 0 was assigned to variable 'error'
but the variable was never read before reassignemnt later. So the assignment can be removed.
Signed-off-by Mateusz Nosek <[email protected]>
--- mm/shmem.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
mm/shmem.c +3 -6
@@ -3116,12 +3116,9 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s error =security_inode_init_security (inode, dir, &dentry->d_name, shmem_initxattrs,NULL ); -if (error) { -if (error != -EOPNOTSUPP ) { -iput (inode); -return error; - } - error =0 ; +if (error && error != -EOPNOTSUPP ) { +iput (inode); +return error; } inode->i_size = len-1 ;
Signature · 1 line
2.17.1
Quoted 3 lines · On Sun, Mar 01, 2020 at 04:28:32PM +0100, [email protected] wrote:
Previously 0 was assigned to variable 'error'
but the variable was never read before reassignemnt later. So the assignment can be removed.
Reviewed-by Matthew Wilcox (Oracle) <[email protected]>
Quoted 32 lines
From: Mateusz Nosek <[email protected]>
Previously 0 was assigned to variable 'error'
but the variable was never read before reassignemnt later. So the assignment can be removed.Signed-off-by Mateusz Nosek <[email protected]>--- mm/shmem.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)mm/shmem.c +3
-7@@ -3116,12 +3116,9 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s error =security_inode_init_security (inode, dir, &dentry->d_name, shmem_initxattrs,NULL ); -if (error) { -if (error != -EOPNOTSUPP ) { -iput (inode); -return error; - } - error =0 ; +if (error && error != -EOPNOTSUPP ) { +iput (inode); +return error; } inode->i_size = len-1 ; --
Quoted 1 line
2.17.1
Acked-by Pankaj Gupta <[email protected]>