Skip to contentSkip to conversation

mux: mmio: fix regmap leak on probe failure

PATCH In review Johan Hovold 3 participants 5 messages Nov 27, 2025 – Feb 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mux: mmio: 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.

Fixes 61de83fd8256 ("mux: mmio: Do not use syscon helper to build regmap")
Cc Andrew Davis <[email protected]>
---
 drivers/mux/mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mux/mmio.c +1 -1
index 9993ce38a818..5b0171d19d43 100644
@@ -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);
Signature · 1 line
2.51.2
Acked-by on v1 1/1
#1 lore raw
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 61de83fd8256 ("mux: mmio: Do not use syscon helper to build regmap")
Cc Andrew Davis <[email protected]>

---

Quoted 16 lines
  drivers/mux/mmio.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mux/mmio.c +1 -1
index 9993ce38a818..5b0171d19d43 100644
@@ -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);
#2 lore raw
In reply to Johan Hovold
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 61de83fd8256 ("mux: mmio: Do not use syscon helper to build regmap")
Cc Andrew Davis <[email protected]>

---

Can this one be picked up for 6.20?

Johan

#3 lore raw

Hi Greg and Peter,

Quoted 6 lines · Johan Hovold
Quoted 5 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.

Quoted 7 lines
Quoted 5 lines
Fixes 61de83fd8256 ("mux: mmio: Do not use syscon helper to build regmap")
Cc Andrew Davis <[email protected]>

---

Can this one be picked up for 6.20?

This one has been sitting on the list for over two months now without any comment from Peter.

I know there have been some issues in the past which patches for this subsystem not being picked up, so perhaps you could just take this one directly, Greg?

It's been reviewed by Andrew.

Johan

#4 lore raw
Quoted 20 lines · Johan Hovold

Hi Greg and Peter,

Quoted 6 lines · Johan Hovold
Quoted 5 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.

Quoted 7 lines
Quoted 5 lines
Fixes 61de83fd8256 ("mux: mmio: Do not use syscon helper to build regmap")
Cc Andrew Davis <[email protected]>

---

Can this one be picked up for 6.20?

This one has been sitting on the list for over two months now without any comment from Peter.

Quoted 7 lines

I know there have been some issues in the past which patches for this subsystem not being picked up, so perhaps you could just take this one directly, Greg?

It's been reviewed by Andrew.

Johan

Now taken, thanks.,

greg k-h