Skip to content

Commit

Permalink
regmap: debugfs: Free map->debugfs_name when debugfs_create_dir() failed
Browse files Browse the repository at this point in the history
Free map->debugfs_name when debugfs_create_dir() failed to avoid memory
leak.

Signed-off-by: Jeffy Chen <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
JeffyCN authored and broonie committed Mar 6, 2018
1 parent 46589e9 commit 17cf46c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/base/regmap/regmap-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 17cf46c

Please sign in to comment.