From 17cf46cfe975f1dd04db6bd38398923846512d49 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Tue, 6 Mar 2018 19:04:03 +0800 Subject: 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 Signed-off-by: Mark Brown --- drivers/base/regmap/regmap-debugfs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/base/regmap') 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; } -- cgit v1.2.3