lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 30 May 2023 16:45:30 +0800
From: Lu Hongfei <luhongfei@...o.com>
To: Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org (open list:ETHERNET PHY LIBRARY),
	linux-kernel@...r.kernel.org (open list)
Cc: opensource.kernel@...o.com,
	luhongfei@...o.com
Subject: [PATCH] net: Replace the ternary conditional operator with min()

It would be better to replace the traditional ternary conditional
operator with min()

Signed-off-by: Lu Hongfei <luhongfei@...o.com>
---
 drivers/net/phy/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/net/phy/phy.c

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0c0df38cd1ab..a8beb4ab8451
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1002,7 +1002,7 @@ static int phy_poll_aneg_done(struct phy_device *phydev)
 	if (!ret)
 		return -ETIMEDOUT;
 
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 
 int phy_ethtool_ksettings_set(struct phy_device *phydev,
@@ -1526,7 +1526,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 		ret = phy_set_bits_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
 				       MDIO_PCS_CTRL1_CLKSTOP_EN);
 
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 EXPORT_SYMBOL(phy_init_eee);
 
-- 
2.39.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ