Message ID | 20210528082240.3863991-3-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: dsa: qca8k: check return value of read functions correctly | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | warning | 4 maintainers not CCed: olteanv@gmail.com f.fainelli@gmail.com linux@armlinux.org.uk kuba@kernel.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 0 |
netdev/header_inline | success | Link |
On Fri, 28 May 2021 16:22:40 +0800 Yang Yingliang wrote: > 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> > --- > drivers/net/dsa/qca8k.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c > index a8c274227348..6fe963ba23e8 100644 > --- a/drivers/net/dsa/qca8k.c > +++ b/drivers/net/dsa/qca8k.c > @@ -1200,6 +1200,8 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, > > /* Enable/disable SerDes auto-negotiation as necessary */ > ret = qca8k_read(priv, QCA8K_REG_PWS, &val); > + if (ret) > + return; > if (phylink_autoneg_inband(mode)) > val &= ~QCA8K_PWS_SERDES_AEN_DIS; > else > @@ -1208,6 +1210,8 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, > > /* Configure the SGMII parameters */ > 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; You should ignore the return value in the previous patch and add the ret variable here, to avoid the transient build warning.
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index a8c274227348..6fe963ba23e8 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -1200,6 +1200,8 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, /* Enable/disable SerDes auto-negotiation as necessary */ ret = qca8k_read(priv, QCA8K_REG_PWS, &val); + if (ret) + return; if (phylink_autoneg_inband(mode)) val &= ~QCA8K_PWS_SERDES_AEN_DIS; else @@ -1208,6 +1210,8 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, /* Configure the SGMII parameters */ 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;
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> --- drivers/net/dsa/qca8k.c | 4 ++++ 1 file changed, 4 insertions(+)