Skip to contentSkip to conversation

dsa: rtl8366: Pass GENMASK() signed bits

PATCH In review Andrew Lunn 4 participants 4 messages Jul 5, 2020

Subsystems (3)
lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

PATCH 1/1 dsa: rtl8366: Pass GENMASK() signed bits

Oddly, GENMASK() requires signed bit numbers, so that it can compare them for < 0. If passed an unsigned type, we get warnings about the test never being true.

---
 drivers/net/dsa/rtl8366.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/rtl8366.c +1 -1
index ac88caca5ad4..993cf3ac59d9 100644
@@ -272,7 +272,7 @@ int rtl8366_init_vlan(struct realtek_smi *smi)
 			/* For the CPU port, make all ports members of this
 			 * VLAN.
 			 */
-			mask = GENMASK(smi->num_ports - 1, 0);
+			mask = GENMASK((int)smi->num_ports - 1, 0);
 		else
 			/* For all other ports, enable itself plus the
 			 * CPU port.
Signature · 1 line
2.27.0.rc2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Andrew Lunn

Oddly, GENMASK() requires signed bit numbers, so that it can compare them for < 0. If passed an unsigned type, we get warnings about the test never being true.

The subject should also be prefixed with "net: " similar to the bcm_sf2 patches you just sent out, with that fixed:

Signature · 1 line
Florian
maintainer
#2 lore raw

From: Florian Fainelli <[email protected]>
Date: Sun, 5 Jul 2020 13:49:10 -0700

Quoted 7 lines · Andrew Lunn
Quoted 4 lines

Oddly, GENMASK() requires signed bit numbers, so that it can compare them for < 0. If passed an unsigned type, we get warnings about the test never being true.

Quoted 6 lines
Quoted 1 line

The subject should also be prefixed with "net: " similar to the bcm_sf2 patches you just sent out, with that fixed:

Applied with Subject fixed.

#3 lore raw
In reply to Andrew Lunn
Quoted 5 lines · Andrew Lunn

Oddly, GENMASK() requires signed bit numbers, so that it can compare them for < 0. If passed an unsigned type, we get warnings about the test never being true.

I just resent my RTL8366RB series and I picked this patch in front of the series so as to make sure it applies. (I also took care to carry forward the same fix in the new code.) I hope there are no other collisions.

Yours,
Linus Walleij