Skip to content

Commit

Permalink
net: dsa: qca8k: add missing check return value in qca8k_phylink_mac_…
Browse files Browse the repository at this point in the history
…config()

Now we can check qca8k_read() return value correctly, so if
it fails, we need return directly.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Yang Yingliang authored and Jakub Kicinski committed May 30, 2021
1 parent 7c9896e commit 9fe99de
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/dsa/qca8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
{
struct qca8k_priv *priv = ds->priv;
u32 reg, val;
int ret;

switch (port) {
case 0: /* 1st CPU port */
Expand Down Expand Up @@ -1198,15 +1199,19 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
qca8k_write(priv, reg, QCA8K_PORT_PAD_SGMII_EN);

/* Enable/disable SerDes auto-negotiation as necessary */
qca8k_read(priv, QCA8K_REG_PWS, &val);
ret = qca8k_read(priv, QCA8K_REG_PWS, &val);
if (ret)
return;
if (phylink_autoneg_inband(mode))
val &= ~QCA8K_PWS_SERDES_AEN_DIS;
else
val |= QCA8K_PWS_SERDES_AEN_DIS;
qca8k_write(priv, QCA8K_REG_PWS, val);

/* Configure the SGMII parameters */
qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val);
ret = qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val);
if (ret)
return;

val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX |
QCA8K_SGMII_EN_TX | QCA8K_SGMII_EN_SD;
Expand Down

0 comments on commit 9fe99de

Please sign in to comment.