summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorJeffy Chen <jeffy.chen@rock-chips.com>2018-03-06 19:04:03 +0800
committerMark Brown <broonie@kernel.org>2018-03-06 14:20:50 +0000
commit17cf46cfe975f1dd04db6bd38398923846512d49 (patch)
treea77ee88d3b0b018eadfe6ae893ed7a98a995a494 /drivers/base
parent46589e9c753b7c905e8671a89cbb9728f3b99855 (diff)
downloadlinux-17cf46cfe975f1dd04db6bd38398923846512d49.tar.gz
linux-17cf46cfe975f1dd04db6bd38398923846512d49.tar.bz2
linux-17cf46cfe975f1dd04db6bd38398923846512d49.zip
regmap: debugfs: Free map->debugfs_name when debugfs_create_dir() failed
Free map->debugfs_name when debugfs_create_dir() failed to avoid memory leak. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-debugfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index dd3a16894e3c..c84f5ceb015a 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -584,6 +584,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
if (!map->debugfs) {
dev_warn(map->dev, "Failed to create debugfs directory\n");
+
+ kfree(map->debugfs_name);
+ map->debugfs_name = NULL;
return;
}