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>
This commit is contained in:
Jeffy Chen 2018-03-06 19:04:03 +08:00 committed by Mark Brown
parent 46589e9c75
commit 17cf46cfe9
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 3 additions and 0 deletions

View File

@ -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;
}