Skip to content

Commit

Permalink
Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/broonie/regmap

Pull regmap fixes from Mark Brown:
 "A couple of small fixes for leaks when attaching a device to a
  preexisting regmap"

* tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init()
  regmap: debugfs: Fix a memory leak when calling regmap_attach_dev
  • Loading branch information
torvalds committed Jan 7, 2021
2 parents 71c061d + f6bcb4c commit fc37784
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/base/regmap/regmap-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,18 +582,23 @@ void regmap_debugfs_init(struct regmap *map)
devname = dev_name(map->dev);

if (name) {
map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
if (!map->debugfs_name) {
map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
devname, name);
if (!map->debugfs_name)
return;
}
name = map->debugfs_name;
} else {
name = devname;
}

if (!strcmp(name, "dummy")) {
kfree(map->debugfs_name);

map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",
dummy_index);
if (!map->debugfs_name)
return;
name = map->debugfs_name;
dummy_index++;
}
Expand Down

0 comments on commit fc37784

Please sign in to comment.