mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init()
commit f6bcb4c7f366905b66ce8ffca7190118244bb642 upstream.
This code will leak "map->debugfs_name" because the if statement is
reversed so it only frees NULL pointers instead of non-NULL. In
fact the if statement is not required and should just be removed
because kfree() accepts NULL pointers.
Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev")
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/X/RQpfAwRdLg0GqQ@mwanda
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
bbb2fee395
commit
6f48409619
1 changed files with 1 additions and 3 deletions
|
|
@ -595,9 +595,7 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
|
|||
}
|
||||
|
||||
if (!strcmp(name, "dummy")) {
|
||||
if (!map->debugfs_name)
|
||||
kfree(map->debugfs_name);
|
||||
|
||||
kfree(map->debugfs_name);
|
||||
map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",
|
||||
dummy_index);
|
||||
if (!map->debugfs_name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue