Unverified Commit ba28a07a authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown
Browse files

ASoC: cs-amp-lib: Fix missing dput() after debugfs_lookup()



Rewrite cs_amp_create_debugfs() so that dput() will be called on
a valid dentry returned from debugfs_lookup().

The pointer returned from debugfs_lookup() must be released by dput().
The pointer returned from debugfs_create_dir() does not need to be
passed to dput().

Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Fixes: cdd27fa3 ("ASoC: cs-amp-lib: Add helpers for factory calibration")
Link: https://patch.msgid.link/20260521122511.987322-3-rf@opensource.cirrus.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 67a52d3e
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -833,10 +833,17 @@ EXPORT_SYMBOL_NS_GPL(cs_amp_devm_get_vendor_specific_variant_id, "SND_SOC_CS_AMP
 */
struct dentry *cs_amp_create_debugfs(struct device *dev)
{
	struct dentry *dir;
	struct dentry *dir, *created;

	/* debugfs_lookup() can return NULL or ERR_PTR on error */
	dir = debugfs_lookup("cirrus_logic", NULL);
	if (!dir)
	if (!IS_ERR_OR_NULL(dir)) {
		created = debugfs_create_dir(dev_name(dev), dir);
		dput(dir);

		return created;
	}

	dir = debugfs_create_dir("cirrus_logic", NULL);

	return debugfs_create_dir(dev_name(dev), dir);