Obtain printbuf failure status with printbuf_err helper. Signed-off-by: Hongbo Li <lihongb...@huawei.com> --- fs/bcachefs/opts.c | 7 +------ fs/bcachefs/sysfs.c | 4 +--- 2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index 83f55cf99d46..cdef7a886695 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -543,12 +543,7 @@ int bch2_parse_one_mount_opt(struct bch_fs *c, struct bch_opts *opts, ret = bch2_opt_parse(c, &bch2_opt_table[id], val, &v, &err); if (ret == -BCH_ERR_option_needs_open_fs && parse_later) { prt_printf(parse_later, "%s=%s,", name, val); - if (parse_later->allocation_failure) { - ret = -ENOMEM; - goto out; - } - - ret = 0; + ret = printbuf_err(parse_later); goto out; } diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 97733c766948..70084b646511 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -63,9 +63,7 @@ static ssize_t fn ## _show(struct kobject *kobj, struct attribute *attr,\ if (out.pos && out.buf[out.pos - 1] != '\n') \ prt_newline(&out); \ \ - if (!ret && out.allocation_failure) \ - ret = -ENOMEM; \ - \ + ret = ret ?: printbuf_err(&out); \ if (!ret) { \ ret = min_t(size_t, out.pos, PAGE_SIZE - 1); \ memcpy(buf, out.buf, ret); \ -- 2.34.1