All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: landen.chao@mediatek.com
Cc: linux-mediatek@lists.infradead.org
Subject: [bug report] net: dsa: mt7530: Add the support of MT7531 switch
Date: Wed, 16 Sep 2020 17:35:05 +0300	[thread overview]
Message-ID: <20200916143505.GA766413@mwanda> (raw)

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

             reply	other threads:[~2020-09-16 14:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 14:35 Dan Carpenter [this message]
2020-09-17  7:15 ` [bug report] net: dsa: mt7530: Add the support of MT7531 switch Landen Chao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916143505.GA766413@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=landen.chao@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.