phy: ti: gmii-sel: fix regmap leak on probe failure
Subsystems (2)
PATCH 1/1 phy: ti: gmii-sel: fix regmap leak on probe failure
The mmio regmap that may be allocated during probe is never freed.
Switch to using the device managed allocator so that the regmap is released on probe failures (e.g. probe deferral) and on driver unbind.
--- drivers/phy/ti/phy-gmii-sel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/ti/phy-gmii-sel.c +1 -1
@@ -512,7 +512,7 @@ static int phy_gmii_sel_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (base),"failed to get base memory resource\n" ); - priv->regmap =regmap_init_mmio (dev, base, &phy_gmii_sel_regmap_cfg); + priv->regmap =devm_regmap_init_mmio (dev, base, &phy_gmii_sel_regmap_cfg);if (IS_ERR (priv->regmap))return dev_err_probe (dev,PTR_ERR (priv->regmap),"Failed to get syscon\n" );
Signature · 1 line
2.51.2
Quoted 10 lines · Johan Hovold
The mmio regmap that may be allocated during probe is never freed.
Switch to using the device managed allocator so that the regmap is released on probe failures (e.g. probe deferral) and on driver unbind.
Fixes 5ab90f40121a ("phy: ti: gmii-sel: Do not use syscon helper to build regmap")Cc [email protected] # 6.14Cc Andrew Davis <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Quoted 16 lines
drivers/phy/ti/phy-gmii-sel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/phy/ti/phy-gmii-sel.c +1
-1@@ -512,7 +512,7 @@ static int phy_gmii_sel_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (base),"failed to get base memory resource\n" ); - priv->regmap =regmap_init_mmio (dev, base, &phy_gmii_sel_regmap_cfg); + priv->regmap =devm_regmap_init_mmio (dev, base, &phy_gmii_sel_regmap_cfg);if (IS_ERR (priv->regmap))return dev_err_probe (dev,PTR_ERR (priv->regmap),"Failed to get syscon\n" );
Quoted 6 lines · Johan Hovold
The mmio regmap that may be allocated during probe is never freed.
Switch to using the device managed allocator so that the regmap is released on probe failures (e.g. probe deferral) and on driver unbind.
Applied, thanks!
[1/1] phy: ti: gmii-sel: fix regmap leak on probe failure
commit: 4914d67da947031d6f645c81c74f7879e0844d5d
Best regards,
Signature · 1 line
~Vinod