regmap: set debugfs_name to NULL after it is freed
authorMeng Li <Meng.Li@windriver.com>
Fri, 26 Feb 2021 02:17:37 +0000 (10:17 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 10 Mar 2021 12:20:54 +0000 (12:20 +0000)
commite41a962f82e7afb5b1ee644f48ad0b3aee656268
tree60ed25d7448d8eca613f4bc99c4af181a24d4347
parenta38fd8748464831584a19438cbb3082b5a2dab15
regmap: set debugfs_name to NULL after it is freed

There is a upstream commit cffa4b2122f5("regmap:debugfs:
Fix a memory leak when calling regmap_attach_dev") that
adds a if condition when create name for debugfs_name.
With below function invoking logical, debugfs_name is
freed in regmap_debugfs_exit(), but it is not created again
because of the if condition introduced by above commit.
regmap_reinit_cache()
regmap_debugfs_exit()
...
regmap_debugfs_init()
So, set debugfs_name to NULL after it is freed.

Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev")
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Link: https://lore.kernel.org/r/20210226021737.7690-1-Meng.Li@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-debugfs.c