Skip to content

Commit 66626b1

Browse files
rfvirgilbroonie
authored andcommitted
firmware: cirrus: cs_dsp: Initialize debugfs_root to invalid
Initialize debugfs_root to -ENODEV so that if the client never sets a valid debugfs root the debugfs files will not be created. A NULL pointer passed to any of the debugfs_create_*() functions means "create in the root of debugfs". It doesn't mean "ignore". Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://msgid.link/r/20240307105353.40067-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7df3eb4 commit 66626b1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/firmware/cirrus/cs_dsp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ void cs_dsp_cleanup_debugfs(struct cs_dsp *dsp)
522522
{
523523
cs_dsp_debugfs_clear(dsp);
524524
debugfs_remove_recursive(dsp->debugfs_root);
525-
dsp->debugfs_root = NULL;
525+
dsp->debugfs_root = ERR_PTR(-ENODEV);
526526
}
527527
EXPORT_SYMBOL_NS_GPL(cs_dsp_cleanup_debugfs, FW_CS_DSP);
528528
#else
@@ -2246,6 +2246,11 @@ static int cs_dsp_common_init(struct cs_dsp *dsp)
22462246

22472247
mutex_init(&dsp->pwr_lock);
22482248

2249+
#ifdef CONFIG_DEBUG_FS
2250+
/* Ensure this is invalid if client never provides a debugfs root */
2251+
dsp->debugfs_root = ERR_PTR(-ENODEV);
2252+
#endif
2253+
22492254
return 0;
22502255
}
22512256

0 commit comments

Comments
 (0)