mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
Subsystems (2)
PATCH 1/1 mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
Make sure to drop the reference taken to the sysmgr platform device when retrieving its driver data.
Note that holding a reference to a device does not prevent its driver data from going away.
--- drivers/mfd/altera-sysmgr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mfd/altera-sysmgr.c +2 -0
@@ -117,6 +117,8 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, sysmgr =dev_get_drvdata (dev); +put_device (dev); +return sysmgr->regmap; }EXPORT_SYMBOL_GPL (altr_sysmgr_regmap_lookup_by_phandle);
Signature · 1 line
2.49.1
Quoted 2 lines
Make sure to drop the reference taken to the sysmgr platform device when retrieving its driver data.
…
How do you think about to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/device.h#L1180
Regards,
Markus
Re: (subset) [PATCH] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
In reply to Johan HovoldQuoted 8 lines · Johan Hovold
Make sure to drop the reference taken to the sysmgr platform device when retrieving its driver data.
Note that holding a reference to a device does not prevent its driver data from going away.
[...]
Applied, thanks!
[1/1] mfd: altera-sysmgr: fix device leak on sysmgr regmap lookup
commit: e6ce75fac4a299805939e33f9f104829ba9ffdcc
--
Lee Jones [李琼斯]