Commit fc37784d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -582,8 +582,12 @@ void regmap_debugfs_init(struct regmap *map)
		devname = dev_name(map->dev);

	if (name) {
		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;
@@ -591,9 +595,10 @@ void regmap_debugfs_init(struct regmap *map)

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