Re: [PATCH v3 1/3] net: phy: mscc: move shared probe code into a helper

From: David Miller
Date: Mon Jun 15 2020 - 21:11:34 EST


From: Heiko Stuebner <heiko@xxxxxxxxx>
Date: Mon, 15 Jun 2020 16:44:59 +0200

> static int vsc8584_probe(struct phy_device *phydev)
> {
> struct vsc8531_private *vsc8531;
> + int rc;
> u32 default_mode[4] = {VSC8531_LINK_1000_ACTIVITY,
> VSC8531_LINK_100_ACTIVITY, VSC8531_LINK_ACTIVITY,
> VSC8531_DUPLEX_COLLISION};
> @@ -2005,32 +2015,24 @@ static int vsc8584_probe(struct phy_device *phydev)
> return -ENOTSUPP;
> }
>
> - vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL);
> - if (!vsc8531)
> - return -ENOMEM;

Because you removed this devm_kzalloc() code, vsc8531 is never initialized.

> + return devm_phy_package_join(&phydev->mdio.dev, phydev,
> + vsc8531->base_addr, 0);

But it is still dereferenced here.

Did the compiler really not warn you about this when you test built
these changes?