Skip to content

Commit fd4056d

Browse files
Russell King (Oracle)Paolo Abeni
authored andcommitted
net: pcs: xpcs: remove return statements in void function
While using "return" when calling a void returning function inside a function that returns void doesn't cause a compiler warning, it looks weird. Convert the bunch of if() statements to a switch() and remove these return statements. Signed-off-by: Russell King (Oracle) <[email protected]> Tested-by: Serge Semin <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 11afdf3 commit fd4056d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,13 +1140,20 @@ static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
11401140
{
11411141
struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
11421142

1143-
if (interface == PHY_INTERFACE_MODE_USXGMII)
1144-
return xpcs_link_up_usxgmii(xpcs, speed);
1143+
switch (interface) {
1144+
case PHY_INTERFACE_MODE_USXGMII:
1145+
xpcs_link_up_usxgmii(xpcs, speed);
1146+
break;
1147+
1148+
case PHY_INTERFACE_MODE_SGMII:
1149+
case PHY_INTERFACE_MODE_1000BASEX:
1150+
xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface, speed,
1151+
duplex);
1152+
break;
11451153

1146-
if (interface == PHY_INTERFACE_MODE_SGMII ||
1147-
interface == PHY_INTERFACE_MODE_1000BASEX)
1148-
return xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface,
1149-
speed, duplex);
1154+
default:
1155+
break;
1156+
}
11501157
}
11511158

11521159
static void xpcs_an_restart(struct phylink_pcs *pcs)

0 commit comments

Comments
 (0)