net: phy: nxp-c45-tja11xx: Fix incorrect usage of devm_kzalloc
Subsystems (3)
PATCH 1/1 net: phy: nxp-c45-tja11xx: Fix incorrect usage of devm_kzalloc
devm_kzalloc needs to pass udevice for first parameter, this phy driver wrongly pass the priv in phy_device. And because the dev in phy_device is only valid after phy_connect, in probe phase this dev is NULL, so we can't use devm_kzalloc, replace it with kzalloc.
Signed-off-by Ye Li <[email protected]>
--- drivers/net/phy/nxp-c45-tja11xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/nxp-c45-tja11xx.c +1 -1
@@ -343,7 +343,7 @@ static int nxp_c45_probe(struct phy_device *phydev) {struct nxp_c45_phy *priv; - priv =devm_kzalloc (phydev->priv,sizeof (*priv),GFP_KERNEL ); + priv =kzalloc (sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
Signature · 1 line
2.37.1
Quoted 6 lines · Ye Li
devm_kzallocneeds to pass udevice for first parameter, this phy driver wrongly pass the priv inphy_device. And because the dev inphy_deviceis only valid afterphy_connect, in probe phase this dev is NULL, so we can't usedevm_kzalloc, replace it with kzalloc.Signed-off-by Ye Li <[email protected]>
Reviewed-by Peng Fan <[email protected]>