[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200720204353.GO1339445@lunn.ch>
Date: Mon, 20 Jul 2020 22:43:53 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Helmut Grohne <helmut.grohne@...enta.de>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Woojung Huh <woojung.huh@...rochip.com>,
Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Tristram Ha <Tristram.Ha@...rochip.com>
Subject: Re: [PATCH v3] net: dsa: microchip: call phy_remove_link_mode during
probe
Ignoring the part about how to cleanup this internal phydev for the
moment.
> int ksz9477_switch_register(struct ksz_device *dev)
> {
> - return ksz_switch_register(dev, &ksz9477_dev_ops);
> + int ret, i;
> + struct phy_device *phydev;
> +
> + ret = ksz_switch_register(dev, &ksz9477_dev_ops);
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < dev->phy_port_cnt; ++i) {
> + phydev = dsa_to_port(dev->ds, i)->slave->phydev;
There is no guarantee this phydev actually exists, as far as i
remember. It will only be allocated for user ports. If a port is not
used, i.e. not listed in DT, it won't have a phydev. So you should add
a test:
if (!dsa_is_user(ds, i))
continue;
Otherwise, this now seems correct.
Andrew
Powered by blists - more mailing lists