]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
phy: ti: gmii-sel: fix regmap leak on probe failure
authorJohan Hovold <johan@kernel.org>
Thu, 27 Nov 2025 13:48:34 +0000 (14:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:44 +0000 (11:18 +0100)
commit 4914d67da947031d6f645c81c74f7879e0844d5d upstream.

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: stable@vger.kernel.org # 6.14
Cc: Andrew Davis <afd@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://patch.msgid.link/20251127134834.2030-1-johan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/phy/ti/phy-gmii-sel.c

index 2c2256fe5a3b6f8363b2addc6124d87680f5b280..447fc3c582c00e4731619c600017f8c719830609 100644 (file)
@@ -480,7 +480,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");