Re: [net-next PATCH 1/3] net: phy: extend PHY package API to support multiple global address

From: Andrew Lunn
Date: Sun Nov 26 2023 - 13:19:36 EST


> > static inline int phy_package_read(struct phy_device *phydev,
> > unsigned int addr_offset, u32 regnum)
> > {
> > struct phy_package_shared *shared = phydev->shared;
> > int addr = shared->base_addr + addr_offset;
>
> Isn't this problematic if shared is NULL?

Duh! Yes, it is. But why should shared be NULL? The driver is doing a
read on the package before the package is created. That is a bug. So
an Opps is O.K, it helps find the bug. So i would drop the test for
!shared.

Andrew