Re: [PATCH net-next 3/3] et: mdio: mscc-miim: add lan966x internal phy reset support

From: Andrew Lunn
Date: Sun Mar 13 2022 - 10:44:24 EST


> /* When high resolution timers aren't built-in: we can't use usleep_range() as
> @@ -157,27 +166,29 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id,
> static int mscc_miim_reset(struct mii_bus *bus)
> {
> struct mscc_miim_dev *miim = bus->priv;
> - int offset = miim->phy_reset_offset;
> - int mask = PHY_CFG_PHY_ENA | PHY_CFG_PHY_COMMON_RESET |
> - PHY_CFG_PHY_RESET;
> + unsigned int offset, mask;
> int ret;
>
> - if (miim->phy_regs) {
> - ret = regmap_write(miim->phy_regs, offset, 0);
> - if (ret < 0) {
> - WARN_ONCE(1, "mscc reset set error %d\n", ret);
> - return ret;
> - }
> + if (!miim->phy_regs || !miim->info)
> + return 0;

I would put the check for miim->info in the probe. Not checking the
return value from *_get_match_data() is one of the things the bots
reports and we receive patches for. You have the check, but it is
hidden away, and i doubt the bot nor the bot handlers are clever
enough to find it.

Andrew