[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210528141512.6677afec@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date: Fri, 28 May 2021 14:15:12 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Yang Yingliang <yangyingliang@...wei.com>
Cc: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<andrew@...n.ch>, <vivien.didelot@...il.com>, <davem@...emloft.net>
Subject: Re: [PATCH -next 1/2] net: dsa: qca8k: check return value of read
functions correctly
On Fri, 28 May 2021 16:22:39 +0800 Yang Yingliang wrote:
> Current return type of qca8k_mii_read32() and qca8k_read() are
> unsigned, it can't be negative, so the return value check is
> unuseful. For check the return value correctly, change return
> type of the read functions and add a output parameter to store
> the read value.
>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> @@ -1141,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 */
> @@ -1211,7 +1199,7 @@ 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 */
> - val = qca8k_read(priv, QCA8K_REG_PWS);
> + ret = qca8k_read(priv, QCA8K_REG_PWS, &val);
> if (phylink_autoneg_inband(mode))
> val &= ~QCA8K_PWS_SERDES_AEN_DIS;
> else
> @@ -1219,7 +1207,7 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
> qca8k_write(priv, QCA8K_REG_PWS, val);
>
> /* Configure the SGMII parameters */
> - val = qca8k_read(priv, QCA8K_REG_SGMII_CTRL);
> + ret = qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val);
>
> val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX |
> QCA8K_SGMII_EN_TX | QCA8K_SGMII_EN_SD;
drivers/net/dsa/qca8k.c: In function ‘qca8k_phylink_mac_config’:
drivers/net/dsa/qca8k.c:1131:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
1131 | int ret;
| ^~~
Powered by blists - more mailing lists