linux-phy.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: ti: gmii-sel: fix regmap leak on probe failure
@ 2025-11-27 13:48 Johan Hovold
  2025-12-01 18:02 ` Andrew Davis
  2025-12-23 17:34 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2025-11-27 13:48 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: linux-phy, linux-kernel, Johan Hovold, stable, Andrew Davis

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>
---
 drivers/phy/ti/phy-gmii-sel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c
index 50adabb867cb..26209a89703a 100644
--- a/drivers/phy/ti/phy-gmii-sel.c
+++ b/drivers/phy/ti/phy-gmii-sel.c
@@ -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");
-- 
2.51.2


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] phy: ti: gmii-sel: fix regmap leak on probe failure
  2025-11-27 13:48 [PATCH] phy: ti: gmii-sel: fix regmap leak on probe failure Johan Hovold
@ 2025-12-01 18:02 ` Andrew Davis
  2025-12-23 17:34 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Davis @ 2025-12-01 18:02 UTC (permalink / raw)
  To: Johan Hovold, Vinod Koul, Kishon Vijay Abraham I
  Cc: linux-phy, linux-kernel, stable

On 11/27/25 7:48 AM, Johan Hovold wrote:
> 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>

>   drivers/phy/ti/phy-gmii-sel.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c
> index 50adabb867cb..26209a89703a 100644
> --- a/drivers/phy/ti/phy-gmii-sel.c
> +++ b/drivers/phy/ti/phy-gmii-sel.c
> @@ -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");


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] phy: ti: gmii-sel: fix regmap leak on probe failure
  2025-11-27 13:48 [PATCH] phy: ti: gmii-sel: fix regmap leak on probe failure Johan Hovold
  2025-12-01 18:02 ` Andrew Davis
@ 2025-12-23 17:34 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2025-12-23 17:34 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Johan Hovold
  Cc: linux-phy, linux-kernel, stable, Andrew Davis


On Thu, 27 Nov 2025 14:48:34 +0100, Johan Hovold wrote:
> 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,
-- 
~Vinod



-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-23 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27 13:48 [PATCH] phy: ti: gmii-sel: fix regmap leak on probe failure Johan Hovold
2025-12-01 18:02 ` Andrew Davis
2025-12-23 17:34 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).