netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: fix a signedness bug in genphy_loopback()
@ 2023-05-26 11:45 Dan Carpenter
  2023-05-26 11:50 ` Russell King (Oracle)
  2023-05-30  4:58 ` Jakub Kicinski
  0 siblings, 2 replies; 17+ messages in thread
From: Dan Carpenter @ 2023-05-26 11:45 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev,
	kernel-janitors

The "val" variable is used to store error codes from phy_read() so
it needs to be signed for the error handling to work as expected.

Fixes: 014068dcb5b1 ("net: phy: genphy_loopback: add link speed configuration")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/phy/phy_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2cad9cc3f6b8..d52dd699ae0b 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2700,8 +2700,8 @@ EXPORT_SYMBOL(genphy_resume);
 int genphy_loopback(struct phy_device *phydev, bool enable)
 {
 	if (enable) {
-		u16 val, ctl = BMCR_LOOPBACK;
-		int ret;
+		u16 ctl = BMCR_LOOPBACK;
+		int val, ret;
 
 		ctl |= mii_bmcr_encode_fixed(phydev->speed, phydev->duplex);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-05-30 21:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-26 11:45 [PATCH net] net: phy: fix a signedness bug in genphy_loopback() Dan Carpenter
2023-05-26 11:50 ` Russell King (Oracle)
2023-05-30  4:58 ` Jakub Kicinski
2023-05-30  9:01   ` Russell King (Oracle)
2023-05-30  9:06   ` Paolo Abeni
2023-05-30  9:23     ` Dan Carpenter
2023-05-30  9:40       ` Paolo Abeni
2023-05-30  9:49       ` Russell King (Oracle)
2023-05-30 10:06         ` Russell King (Oracle)
2023-05-30 12:39   ` Andrew Lunn
2023-05-30 14:40     ` Dan Carpenter
2023-05-30 17:06       ` Andrew Lunn
2023-05-30 19:19     ` Jakub Kicinski
2023-05-30 19:39       ` Russell King (Oracle)
2023-05-30 20:04         ` Andrew Lunn
2023-05-30 21:09           ` Russell King (Oracle)
2023-05-30 21:28             ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).