regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 5 Jan 2021 11:42:29 +0000 (14:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 13:17:06 +0000 (14:17 +0100)
commit75e5e51acf59ff7436605ef91f486f9543534f9e
tree9e9501619c91f1c0403c70b0aedb2d8825e187f1
parent43f6ea41408b651180e49bef2f7a2f5f5d40a9a4
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 <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X/RQpfAwRdLg0GqQ@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/regmap/regmap-debugfs.c