diff mbox series

[net-next,2/7] net: simplify handling of dsa_ndo_eth_ioctl() return code

Message ID 20230402123755.2592507-3-vladimir.oltean@nxp.com (mailing list archive)
State Accepted
Commit 1193db2a55b6b04f296f03affdfa80c16ecc3814
Delegated to: Netdev Maintainers
Headers show
Series Convert dsa_master_ioctl() to netdev notifier | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 20 this patch: 20
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Vladimir Oltean April 2, 2023, 12:37 p.m. UTC
In the expression "x == 0 || x != -95", the term "x == 0" does not
change the expression's logical value, because 0 != -95, and so,
if x is 0, the expression would still be true by virtue of the second
term. If x is non-zero, the expression depends on the truth value of
the second term anyway. As such, the first term is redundant and can
be deleted.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/core/dev_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Fainelli April 2, 2023, 12:47 p.m. UTC | #1
On 4/2/2023 5:37 AM, Vladimir Oltean wrote:
> In the expression "x == 0 || x != -95", the term "x == 0" does not
> change the expression's logical value, because 0 != -95, and so,
> if x is 0, the expression would still be true by virtue of the second
> term. If x is non-zero, the expression depends on the truth value of
> the second term anyway. As such, the first term is redundant and can
> be deleted.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 1c0256ea522f..b299fb23fcfa 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -249,7 +249,7 @@  static int dev_eth_ioctl(struct net_device *dev,
 	int err;
 
 	err = dsa_ndo_eth_ioctl(dev, ifr, cmd);
-	if (err == 0 || err != -EOPNOTSUPP)
+	if (err != -EOPNOTSUPP)
 		return err;
 
 	if (ops->ndo_eth_ioctl) {