Commit fc37784d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/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
parents 71c061d2 f6bcb4c7
...@@ -582,8 +582,12 @@ void regmap_debugfs_init(struct regmap *map) ...@@ -582,8 +582,12 @@ void regmap_debugfs_init(struct regmap *map)
devname = dev_name(map->dev); devname = dev_name(map->dev);
if (name) { if (name) {
if (!map->debugfs_name) {
map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
devname, name); devname, name);
if (!map->debugfs_name)
return;
}
name = map->debugfs_name; name = map->debugfs_name;
} else { } else {
name = devname; name = devname;
...@@ -591,9 +595,10 @@ void regmap_debugfs_init(struct regmap *map) ...@@ -591,9 +595,10 @@ void regmap_debugfs_init(struct regmap *map)
if (!strcmp(name, "dummy")) { if (!strcmp(name, "dummy")) {
kfree(map->debugfs_name); kfree(map->debugfs_name);
map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d", map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",
dummy_index); dummy_index);
if (!map->debugfs_name)
return;
name = map->debugfs_name; name = map->debugfs_name;
dummy_index++; dummy_index++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment