ceph: remove unnecessary return in switch statement
PATCH 1/1 ceph: remove unnecessary return in switch statement
Since there's a return immediately after the 'break', there's no need for this extra 'return' in the S_IFDIR case.
--- fs/ceph/file.c | 2 -- 1 file changed, 2 deletions(-)
fs/ceph/file.c +0 -2
@@ -256,8 +256,6 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)case S_IFDIR : ret =ceph_init_file_info (inode, file, fmode,S_ISDIR (inode->i_mode)); -if (ret) -return ret;break ;case S_IFLNK :
From: Luis Henriques
Quoted 15 lines
Sent: 14 August 2020 10:38
Since there's a return immediately after the 'break', there's no need for this extra 'return' in the
S_IFDIRcase.Signed-off-by Luis Henriques <[email protected]>--- fs/ceph/file.c | 2 -- 1 file changed, 2 deletions(-)fs/ceph/file.c +0
-0
fs/ceph/file.c static int ceph_init_file(struct inode *inode, struct file *file, int fmode) · line 261
Quoted 8 lines
fs/ceph/file.c +0
-2@@ -256,8 +256,6 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)case S_IFDIR : ret =ceph_init_file_info (inode, file, fmode,S_ISDIR (inode->i_mode)); -if (ret) -return ret;break ;case S_IFLNK :
I'd move the other way and just do:
return ceph_init_file_info(...); David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 23 lines · David Laight
From: Luis Henriques
Quoted 22 lines
Sent: 14 August 2020 10:38
Since there's a return immediately after the 'break', there's no need for this extra 'return' in the
S_IFDIRcase.Signed-off-by Luis Henriques <[email protected]>--- fs/ceph/file.c | 2 -- 1 file changed, 2 deletions(-)fs/ceph/file.c +0
-2@@ -256,8 +256,6 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)case S_IFDIR : ret =ceph_init_file_info (inode, file, fmode,S_ISDIR (inode->i_mode)); -if (ret) -return ret;break ;
Quoted 4 lines
fs/ceph/file.c static int ceph_init_file(struct inode *inode, struct file *file, int fmode) · line 261
Quoted 1 line
fs/ceph/file.c +0
-0case S_IFLNK :I'd move the other way and just do:
return ceph_init_file_info(...);
Sure, that would work too, although my preference would be to have a single function exit point. But I'll leave that decision to Jeff :-)
Cheers,
Signature · 1 line
Luis
Quoted 7 lines
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 25 lines · Luis Henriques
Quoted 23 lines · David Laight
From: Luis Henriques
Quoted 22 lines
Sent: 14 August 2020 10:38
Since there's a return immediately after the 'break', there's no need for this extra 'return' in the
S_IFDIRcase.Signed-off-by Luis Henriques <[email protected]>--- fs/ceph/file.c | 2 -- 1 file changed, 2 deletions(-)fs/ceph/file.c +0
-2@@ -256,8 +256,6 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)case S_IFDIR : ret =ceph_init_file_info (inode, file, fmode,S_ISDIR (inode->i_mode)); -if (ret) -return ret;break ;
Quoted 8 lines
Quoted 4 lines
fs/ceph/file.c static int ceph_init_file(struct inode *inode, struct file *file, int fmode) · line 261
Quoted 1 line
fs/ceph/file.c +0
-0case S_IFLNK :I'd move the other way and just do:
return ceph_init_file_info(...);Sure, that would work too, although my preference would be to have a single function exit point. But I'll leave that decision to Jeff :-)
I think I agree with Luis here (though it's really a bit subjective). I don't think it'll matter much to the compiled result either way, and that will probably be better if this function grows in complexity.
I'll plan to merge this patch in the next day or so.
Thanks!
Signature · 1 line
Jeff Layton <[email protected]>