Skip to content

Commit aa12a79

Browse files
Chunhai Guohsiangkao
authored andcommitted
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: Gao Xiang <[email protected]> Signed-off-by: Chunhai Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jingbo Xu <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Signed-off-by: Gao Xiang <[email protected]>
1 parent 496530c commit aa12a79

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

fs/erofs/decompressor_deflate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int __init z_erofs_deflate_init(void)
7070
return 0;
7171

7272
out_failed:
73-
pr_err("failed to allocate zlib workspace\n");
73+
erofs_err(NULL, "failed to allocate zlib workspace");
7474
z_erofs_deflate_exit();
7575
return -ENOMEM;
7676
}

fs/erofs/super.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
2727
vaf.fmt = fmt;
2828
vaf.va = &args;
2929

30-
pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
30+
if (sb)
31+
pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
32+
else
33+
pr_err("%s: %pV", func, &vaf);
3134
va_end(args);
3235
}
3336

@@ -41,7 +44,10 @@ void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
4144
vaf.fmt = fmt;
4245
vaf.va = &args;
4346

44-
pr_info("(device %s): %pV", sb->s_id, &vaf);
47+
if (sb)
48+
pr_info("(device %s): %pV", sb->s_id, &vaf);
49+
else
50+
pr_info("%pV", &vaf);
4551
va_end(args);
4652
}
4753

0 commit comments

Comments
 (0)