]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mux: mmio: fix regmap leak on probe failure
authorJohan Hovold <johan@kernel.org>
Thu, 27 Nov 2025 13:47:02 +0000 (14:47 +0100)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:23 +0000 (07:21 -0500)
[ Upstream commit 3c4ae63073d84abee5d81ce46d86a94e9dae9c89 ]

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: 61de83fd8256 ("mux: mmio: Do not use syscon helper to build regmap")
Cc: stable@vger.kernel.org # 6.16
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/20251127134702.1915-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mux/mmio.c

index 9993ce38a818de12237cd700e4c19359ea7f4c29..5b0171d19d430771dfdd740b8c1f4299c57aaf6c 100644 (file)
@@ -58,7 +58,7 @@ static int mux_mmio_probe(struct platform_device *pdev)
                if (IS_ERR(base))
                        regmap = ERR_PTR(-ENODEV);
                else
-                       regmap = regmap_init_mmio(dev, base, &mux_mmio_regmap_cfg);
+                       regmap = devm_regmap_init_mmio(dev, base, &mux_mmio_regmap_cfg);
                /* Fallback to checking the parent node on "real" errors. */
                if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) {
                        regmap = dev_get_regmap(dev->parent, NULL);