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
This commit is contained in:
@@ -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) {
|
||||||
map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
|
if (!map->debugfs_name) {
|
||||||
|
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)
|
|||||||
|
|
||||||
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++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user