[bug report] net: dsa: mt7530: Add the support of MT7531 switch
Dan Carpenter
dan.carpenter at oracle.com
Wed Sep 16 10:35:05 EDT 2020
Hello Landen Chao,
The patch c288575f7810: "net: dsa: mt7530: Add the support of MT7531
switch" from Sep 11, 2020, leads to the following static checker
warning:
drivers/net/dsa/mt7530.c:2298 mt7531_cpu_port_config()
error: uninitialized symbol 'interface'.
drivers/net/dsa/mt7530.c
2273 static int
2274 mt7531_cpu_port_config(struct dsa_switch *ds, int port)
2275 {
2276 struct mt7530_priv *priv = ds->priv;
2277 phy_interface_t interface;
2278 int speed;
2279
2280 switch (port) {
2281 case 5:
2282 if (mt7531_is_rgmii_port(priv, port))
2283 interface = PHY_INTERFACE_MODE_RGMII;
2284 else
2285 interface = PHY_INTERFACE_MODE_2500BASEX;
2286
2287 priv->p5_interface = interface;
2288 break;
2289 case 6:
2290 interface = PHY_INTERFACE_MODE_2500BASEX;
2291
2292 mt7531_pad_setup(ds, interface);
2293
2294 priv->p6_interface = interface;
2295 break;
Does this need a default case? Smatch thinks "port" can be 0-6.
2296 }
2297
2298 if (interface == PHY_INTERFACE_MODE_2500BASEX)
2299 speed = SPEED_2500;
2300 else
2301 speed = SPEED_1000;
2302
2303 mt7531_mac_config(ds, port, MLO_AN_FIXED, interface);
2304 mt7530_write(priv, MT7530_PMCR_P(port),
2305 PMCR_CPU_PORT_SETTING(priv->id));
2306 mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL,
2307 speed, DUPLEX_FULL, true, true);
2308
2309 return 0;
2310 }
regards,
dan carpenter
More information about the Linux-mediatek
mailing list