Commit aa12a790 authored by Chunhai Guo's avatar Chunhai Guo Committed by Gao Xiang

erofs: make erofs_{err,info}() support NULL sb parameter

Make erofs_err() and erofs_info() support NULL sb parameter for more
general usage.
Suggested-by: default avatarGao Xiang <xiang@kernel.org>
Signed-off-by: default avatarChunhai Guo <guochunhai@vivo.com>
Link: https://lore.kernel.org/r/20240103123202.3054718-1-guochunhai@vivo.comReviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
parent 496530c7
...@@ -70,7 +70,7 @@ int __init z_erofs_deflate_init(void) ...@@ -70,7 +70,7 @@ int __init z_erofs_deflate_init(void)
return 0; return 0;
out_failed: out_failed:
pr_err("failed to allocate zlib workspace\n"); erofs_err(NULL, "failed to allocate zlib workspace");
z_erofs_deflate_exit(); z_erofs_deflate_exit();
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...) ...@@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; 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); va_end(args);
} }
...@@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...) ...@@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
pr_info("(device %s): %pV", sb->s_id, &vaf); if (sb)
pr_info("(device %s): %pV", sb->s_id, &vaf);
else
pr_info("%pV", &vaf);
va_end(args); va_end(args);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment