[PATCH] erofs: make erofs_err() support NULL sb parameter

Chunhai Guo guochunhai at vivo.com
Wed Jan 3 01:25:32 AEDT 2024


Make erofs_err() support NULL sb parameter for more general usage.

Suggested-by: Gao Xiang <xiang at kernel.org>
Signed-off-by: Chunhai Guo <guochunhai at vivo.com>
---
 fs/erofs/super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 3789d6224513..f20dcfacdcc5 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -27,7 +27,11 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
+	if (sb)
+		pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
+	else
+		pr_err("%s: %pV", func, &vaf);
+
 	va_end(args);
 }
 
-- 
2.25.1



More information about the Linux-erofs mailing list