Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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) <rmk+kernel@armlinux.org.uk>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Russell King (Oracle) and committed by
Paolo Abeni
fd4056db 11afdf3b

+13 -6
+13 -6
drivers/net/pcs/pcs-xpcs.c
··· 1140 1140 { 1141 1141 struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); 1142 1142 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; 1145 1147 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); 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; 1153 + 1154 + default: 1155 + break; 1156 + } 1150 1157 } 1151 1158 1152 1159 static void xpcs_an_restart(struct phylink_pcs *pcs)