[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEbqQYDi8_LN7lDj@shell.armlinux.org.uk>
Date: Mon, 9 Jun 2025 15:05:53 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: george.moussalem@...look.com
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org
Subject: Re: [PATCH v4 3/5] net: phy: qcom: at803x: Add Qualcomm IPQ5018
Internal PHY support
On Mon, Jun 09, 2025 at 03:44:36PM +0400, George Moussalem via B4 Relay wrote:
> +static int ipq5018_config_init(struct phy_device *phydev)
> +{
> + struct ipq5018_priv *priv = phydev->priv;
> + u16 val = 0;
Useless initialisation. See the first statement below which immediately
assigns a value to val. I've no idea why people think local variables
need initialising in cases like this, but it seems to have become a
common pattern. I can only guess that someone is teaching this IMHO bad
practice.
> +
> + /*
> + * set LDO efuse: first temporarily store ANA_DAC_FILTER value from
> + * debug register as it will be reset once the ANA_LDO_EFUSE register
> + * is written to
> + */
> + val = at803x_debug_reg_read(phydev, IPQ5018_PHY_DEBUG_ANA_DAC_FILTER);
> + at803x_debug_reg_mask(phydev, IPQ5018_PHY_DEBUG_ANA_LDO_EFUSE,
> + IPQ5018_PHY_DEBUG_ANA_LDO_EFUSE_MASK,
> + IPQ5018_PHY_DEBUG_ANA_LDO_EFUSE_DEFAULT);
> + at803x_debug_reg_write(phydev, IPQ5018_PHY_DEBUG_ANA_DAC_FILTER, val);
> +
> + /* set 8023AZ CTRL values */
> + phy_write_mmd(phydev, MDIO_MMD_PCS, IPQ5018_PHY_PCS_AZ_CTRL1,
> + IPQ5018_PHY_PCS_AZ_CTRL1_VAL);
> + phy_write_mmd(phydev, MDIO_MMD_PCS, IPQ5018_PHY_PCS_AZ_CTRL2,
> + IPQ5018_PHY_PCS_AZ_CTRL2_VAL);
The comment doesn't help understand what's going on here, neither do the
register definition names.
Also, what interface modes on the host side does this PHY actually
support?
> + priv->rst = devm_reset_control_array_get_exclusive(dev);
> + if (IS_ERR_OR_NULL(priv->rst))
> + return dev_err_probe(dev, PTR_ERR(priv->rst),
> + "failed to acquire reset\n");
Why IS_ERR_OR_NULL() ? What error do you think will be returned by this
if priv->rst is NULL? (Hint: PTR_ERR(NULL) is 0.)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists