* [PATCH] hpfs: remove unnecessary checks on the value of r when assigning error code
@ 2018-07-16 14:09 ` Colin King
0 siblings, 0 replies; 2+ messages in thread
From: Colin King @ 2018-07-16 14:09 UTC (permalink / raw)
To: Mikulas Patocka, linux-kernel; +Cc: kernel-janitors
From: Colin Ian King <colin.king@canonical.com>
At the point where r is being checked for different values, r is always
going to be equal to 2 as the previous if statements jump to end or end1
if r is not 2. Hence the assignment to err can be simplified to just
err an assignment without any checks on the value or r.
Detected by CoverityScan, CID#1226737 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/hpfs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index a3615e4c730d..03aded219896 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -565,7 +565,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
err = -EFSERROR;
goto end1;
}
- err = r == 2 ? -ENOSPC : r == 1 ? -EFSERROR : 0;
+ err = -ENOSPC;
goto end1;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] hpfs: remove unnecessary checks on the value of r when assigning error code
@ 2018-07-16 14:09 ` Colin King
0 siblings, 0 replies; 2+ messages in thread
From: Colin King @ 2018-07-16 14:09 UTC (permalink / raw)
To: Mikulas Patocka, linux-kernel; +Cc: kernel-janitors
From: Colin Ian King <colin.king@canonical.com>
At the point where r is being checked for different values, r is always
going to be equal to 2 as the previous if statements jump to end or end1
if r is not 2. Hence the assignment to err can be simplified to just
err an assignment without any checks on the value or r.
Detected by CoverityScan, CID#1226737 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/hpfs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index a3615e4c730d..03aded219896 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -565,7 +565,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
err = -EFSERROR;
goto end1;
}
- err = r = 2 ? -ENOSPC : r = 1 ? -EFSERROR : 0;
+ err = -ENOSPC;
goto end1;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-16 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 14:09 [PATCH] hpfs: remove unnecessary checks on the value of r when assigning error code Colin King
2018-07-16 14:09 ` Colin King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.