Commit 8b2bebdc authored by Yazen Ghannam's avatar Yazen Ghannam Committed by PrithivishS
Browse files

RAS: Avoid build errors when CONFIG_DEBUG_FS=n

mainline inclusion
from mainline-v6.9-rc2
commit a6b227d70d2ad9eb08adc3fe532ebb7ec88ac897
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAYOV8
CVE: NA

Reference: https://github.com/torvalds/linux/commit/a6b227d70d2ad9eb08adc3fe532ebb7ec88ac897

--------------------------------

commit a6b227d70d2ad9eb08adc3fe532ebb7ec88ac897 upstream.

A new helper was introduced for RAS modules to be able to get the RAS
subsystem debugfs root directory. The helper is defined in debugfs.c
which is only built when CONFIG_DEBUG_FS=y.

However, it's possible that the modules would include debugfs support
for optional functionality. One current example is the fmpm module. In
this case, a build error will occur when CONFIG_RAS_FMPM is selected and
CONFIG_DEBUG_FS=n.

Add an inline helper function stub for the CONFIG_DEBUG_FS=n case as the
fmpm module can function without the debugfs functionality too.

Fixes: 9d2b6fa09d15 ("RAS: Export helper to get ras_debugfs_dir")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218640


Reported-by: default avataranthony s. knowles <akira.2020@protonmail.com>
Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Tested-by: default avataranthony s. knowles <akira.2020@protonmail.com>
Link: https://lore.kernel.org/r/20240325183755.776-1-bp@alien8.de


Signed-off-by: default avatarJeevan deep J <j.jeevandeep@amd.com>
Signed-off-by: default avatarPrithivishS <sprithiv@amd.com>
parent b73a74a2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -4,6 +4,10 @@

#include <linux/debugfs.h>

#if IS_ENABLED(CONFIG_DEBUG_FS)
struct dentry *ras_get_debugfs_root(void);
#else
static inline struct dentry *ras_get_debugfs_root(void) { return NULL; }
#endif /* DEBUG_FS */

#endif /* __RAS_DEBUGFS_H__ */