From d95a59805f8f00046bb449fb12161e1f0caf65fb Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Fri, 6 Oct 2017 13:33:44 +1100 Subject: [PATCH] Remove unnecessary equality check Currently `if` statement includes an assignment (from a function return value) and a equality check. The parenthesis are in the incorrect place, currently the code clobbers the function return value because of this. We can fix this by simplifying the `if` statement. `if (foo != 0)` can be more succinctly expressed as `if (foo)` Remove the equality check, add parenthesis to correct the statement. Reviewed-by: Brian Behlendorf Reviewed-by: George Melikov Reviewed-by: Chris Dunlop Signed-off-by: Tobin C. Harding Closes #6685 Close #6719 --- module/zfs/zfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 30cd58f6b..62241a46b 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -4562,7 +4562,7 @@ convoff(struct inode *ip, flock64_t *lckdat, int whence, offset_t offset) int error; if ((lckdat->l_whence == 2) || (whence == 2)) { - if ((error = zfs_getattr(ip, &vap, 0, CRED()) != 0)) + if ((error = zfs_getattr(ip, &vap, 0, CRED()))) return (error); }