From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: torvalds@linux-foundation.org, brauner@kernel.org, jack@suse.cz,
raven@themaw.net, miklos@szeredi.hu, neil@brown.name,
a.hindborg@kernel.org, linux-mm@kvack.org,
linux-efi@vger.kernel.org, ocfs2-devel@lists.linux.dev,
kees@kernel.org, rostedt@goodmis.org, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, paul@paul-moore.com,
casey@schaufler-ca.com, linuxppc-dev@lists.ozlabs.org,
john.johansen@canonical.com, selinux@vger.kernel.org,
borntraeger@linux.ibm.com, bpf@vger.kernel.org
Subject: [PATCH v2 41/50] hypfs: switch hypfs_create_str() to returning int
Date: Tue, 28 Oct 2025 00:46:00 +0000 [thread overview]
Message-ID: <20251028004614.393374-42-viro@zeniv.linux.org.uk> (raw)
In-Reply-To: <20251028004614.393374-1-viro@zeniv.linux.org.uk>
Every single caller only cares about PTR_ERR_OR_ZERO() of return value...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/s390/hypfs/hypfs.h | 3 +--
arch/s390/hypfs/hypfs_diag_fs.c | 40 +++++++++------------------------
arch/s390/hypfs/hypfs_vm_fs.c | 6 ++---
arch/s390/hypfs/inode.c | 9 ++++----
4 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
index 4dc2e068e0ff..0d109d956015 100644
--- a/arch/s390/hypfs/hypfs.h
+++ b/arch/s390/hypfs/hypfs.h
@@ -25,8 +25,7 @@ extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
__u64 value);
-extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name,
- char *string);
+extern int hypfs_create_str(struct dentry *dir, const char *name, char *string);
/* LPAR Hypervisor */
extern int hypfs_diag_init(void);
diff --git a/arch/s390/hypfs/hypfs_diag_fs.c b/arch/s390/hypfs/hypfs_diag_fs.c
index ede951dc0085..2178e6060a5d 100644
--- a/arch/s390/hypfs/hypfs_diag_fs.c
+++ b/arch/s390/hypfs/hypfs_diag_fs.c
@@ -228,8 +228,7 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
return PTR_ERR(rc);
}
diag224_idx2name(cpu_info__ctidx(diag204_get_info_type(), cpu_info), buffer);
- rc = hypfs_create_str(cpu_dir, "type", buffer);
- return PTR_ERR_OR_ZERO(rc);
+ return hypfs_create_str(cpu_dir, "type", buffer);
}
static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr)
@@ -276,8 +275,7 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
if (IS_ERR(rc))
return PTR_ERR(rc);
diag224_idx2name(phys_cpu__ctidx(diag204_get_info_type(), cpu_info), buffer);
- rc = hypfs_create_str(cpu_dir, "type", buffer);
- return PTR_ERR_OR_ZERO(rc);
+ return hypfs_create_str(cpu_dir, "type", buffer);
}
static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr)
@@ -316,41 +314,25 @@ int hypfs_diag_create_files(struct dentry *root)
return rc;
systems_dir = hypfs_mkdir(root, "systems");
- if (IS_ERR(systems_dir)) {
- rc = PTR_ERR(systems_dir);
- goto err_out;
- }
+ if (IS_ERR(systems_dir))
+ return PTR_ERR(systems_dir);
time_hdr = (struct x_info_blk_hdr *)buffer;
part_hdr = time_hdr + info_blk_hdr__size(diag204_get_info_type());
for (i = 0; i < info_blk_hdr__npar(diag204_get_info_type(), time_hdr); i++) {
part_hdr = hypfs_create_lpar_files(systems_dir, part_hdr);
- if (IS_ERR(part_hdr)) {
- rc = PTR_ERR(part_hdr);
- goto err_out;
- }
+ if (IS_ERR(part_hdr))
+ return PTR_ERR(part_hdr);
}
if (info_blk_hdr__flags(diag204_get_info_type(), time_hdr) &
DIAG204_LPAR_PHYS_FLG) {
ptr = hypfs_create_phys_files(root, part_hdr);
- if (IS_ERR(ptr)) {
- rc = PTR_ERR(ptr);
- goto err_out;
- }
+ if (IS_ERR(ptr))
+ return PTR_ERR(ptr);
}
hyp_dir = hypfs_mkdir(root, "hyp");
- if (IS_ERR(hyp_dir)) {
- rc = PTR_ERR(hyp_dir);
- goto err_out;
- }
- ptr = hypfs_create_str(hyp_dir, "type", "LPAR Hypervisor");
- if (IS_ERR(ptr)) {
- rc = PTR_ERR(ptr);
- goto err_out;
- }
- rc = 0;
-
-err_out:
- return rc;
+ if (IS_ERR(hyp_dir))
+ return PTR_ERR(hyp_dir);
+ return hypfs_create_str(hyp_dir, "type", "LPAR Hypervisor");
}
/* Diagnose 224 functions */
diff --git a/arch/s390/hypfs/hypfs_vm_fs.c b/arch/s390/hypfs/hypfs_vm_fs.c
index 6011289afa8c..e8a32d66062b 100644
--- a/arch/s390/hypfs/hypfs_vm_fs.c
+++ b/arch/s390/hypfs/hypfs_vm_fs.c
@@ -100,11 +100,9 @@ int hypfs_vm_create_files(struct dentry *root)
rc = PTR_ERR(dir);
goto failed;
}
- file = hypfs_create_str(dir, "type", "z/VM Hypervisor");
- if (IS_ERR(file)) {
- rc = PTR_ERR(file);
+ rc = hypfs_create_str(dir, "type", "z/VM Hypervisor");
+ if (rc)
goto failed;
- }
/* physical cpus */
dir = hypfs_mkdir(root, "cpus");
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index a4dc8e13d999..c5e2d8932b88 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -398,24 +398,23 @@ struct dentry *hypfs_create_u64(struct dentry *dir,
return dentry;
}
-struct dentry *hypfs_create_str(struct dentry *dir,
- const char *name, char *string)
+int hypfs_create_str(struct dentry *dir, const char *name, char *string)
{
char *buffer;
struct dentry *dentry;
buffer = kmalloc(strlen(string) + 2, GFP_KERNEL);
if (!buffer)
- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;
sprintf(buffer, "%s\n", string);
dentry =
hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE);
if (IS_ERR(dentry)) {
kfree(buffer);
- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;
}
hypfs_add_dentry(dentry);
- return dentry;
+ return 0;
}
static const struct file_operations hypfs_file_ops = {
--
2.47.3
next prev parent reply other threads:[~2025-10-28 0:49 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 0:45 [PATCH v2 00/50] tree-in-dcache stuff Al Viro
2025-10-28 0:45 ` [PATCH v2 01/50] fuse_ctl_add_conn(): fix nlink breakage in case of early failure Al Viro
2025-10-28 0:45 ` [PATCH v2 02/50] tracefs: fix a leak in eventfs_create_events_dir() Al Viro
2025-10-28 1:15 ` Steven Rostedt
2025-10-28 0:45 ` [PATCH v2 03/50] new helper: simple_remove_by_name() Al Viro
2025-10-28 0:45 ` [PATCH v2 04/50] new helper: simple_done_creating() Al Viro
2025-10-28 0:45 ` [PATCH v2 05/50] introduce a flag for explicitly marking persistently pinned dentries Al Viro
2025-10-28 0:45 ` [PATCH v2 06/50] primitives for maintaining persisitency Al Viro
2025-10-28 12:38 ` James Bottomley
2025-10-29 5:10 ` Al Viro
2025-10-29 15:25 ` James Bottomley
2025-10-28 0:45 ` [PATCH v2 07/50] convert simple_{link,unlink,rmdir,rename,fill_super}() to new primitives Al Viro
2025-10-29 14:02 ` [External] : " Mark Tinguely
2025-10-29 17:55 ` Al Viro
2025-10-28 0:45 ` [PATCH v2 08/50] convert ramfs and tmpfs Al Viro
2025-10-28 0:45 ` [PATCH v2 09/50] procfs: make /self and /thread_self dentries persistent Al Viro
2025-10-28 0:45 ` [PATCH v2 10/50] configfs, securityfs: kill_litter_super() not needed Al Viro
2025-10-28 23:58 ` Paul Moore
2025-10-29 6:18 ` Andreas Hindborg
2025-10-28 0:45 ` [PATCH v2 11/50] convert xenfs Al Viro
2025-10-28 0:45 ` [PATCH v2 12/50] convert smackfs Al Viro
2025-10-28 0:45 ` [PATCH v2 13/50] convert hugetlbfs Al Viro
2025-10-28 0:45 ` [PATCH v2 14/50] convert mqueue Al Viro
2025-10-28 0:45 ` [PATCH v2 15/50] convert bpf Al Viro
2025-10-28 0:45 ` [PATCH v2 16/50] convert dlmfs Al Viro
2025-10-28 0:45 ` [PATCH v2 17/50] convert fuse_ctl Al Viro
2025-10-28 0:45 ` [PATCH v2 18/50] convert pstore Al Viro
2025-11-04 1:43 ` Kees Cook
2025-10-28 0:45 ` [PATCH v2 19/50] convert tracefs Al Viro
2025-10-28 15:37 ` Steven Rostedt
2025-10-28 0:45 ` [PATCH v2 20/50] convert debugfs Al Viro
2025-10-28 0:45 ` [PATCH v2 21/50] debugfs: remove duplicate checks in callers of start_creating() Al Viro
2025-10-28 0:45 ` [PATCH v2 22/50] convert efivarfs Al Viro
2025-10-28 12:53 ` James Bottomley
2025-10-28 17:45 ` Al Viro
2025-10-28 21:08 ` Al Viro
2025-10-28 21:34 ` Ard Biesheuvel
2025-10-29 18:08 ` Al Viro
2025-10-29 18:26 ` Ard Biesheuvel
2025-10-29 18:57 ` James Bottomley
2025-10-29 19:37 ` Al Viro
2025-10-29 19:48 ` James Bottomley
2025-10-30 13:35 ` Ard Biesheuvel
2025-11-05 11:47 ` Christian Brauner
2025-11-05 13:09 ` James Bottomley
2025-11-05 13:16 ` Christian Brauner
2025-11-05 13:33 ` James Bottomley
2025-11-05 13:46 ` Christian Brauner
2025-11-05 14:01 ` James Bottomley
2025-11-05 15:23 ` Christian Brauner
2025-11-05 13:43 ` Christian Brauner
2025-11-09 20:40 ` Al Viro
2025-11-11 10:56 ` Christian Brauner
2025-11-19 21:15 ` [REGRESSION] " Chris Bainbridge
2025-11-25 9:00 ` Christian Brauner
2025-11-05 14:34 ` Ard Biesheuvel
2025-10-28 0:45 ` [PATCH v2 23/50] convert spufs Al Viro
2025-10-28 1:15 ` bot+bpf-ci
2025-10-28 1:33 ` Al Viro
2025-10-28 0:45 ` [PATCH v2 24/50] convert ibmasmfs Al Viro
2025-10-28 0:45 ` [PATCH v2 25/50] ibmasmfs: get rid of ibmasmfs_dir_ops Al Viro
2025-10-28 0:45 ` [PATCH v2 26/50] convert devpts Al Viro
2025-10-28 0:45 ` [PATCH v2 27/50] binderfs: use simple_start_creating() Al Viro
2025-10-28 0:45 ` [PATCH v2 28/50] binderfs_binder_ctl_create(): kill a bogus check Al Viro
2025-10-28 0:45 ` [PATCH v2 29/50] convert binderfs Al Viro
2025-10-28 0:45 ` [PATCH v2 30/50] autofs_{rmdir,unlink}: dentry->d_fsdata->dentry == dentry there Al Viro
2025-10-28 0:45 ` [PATCH v2 31/50] convert autofs Al Viro
2025-10-28 1:55 ` Al Viro
2025-10-28 5:32 ` Linus Torvalds
2025-10-28 0:45 ` [PATCH v2 32/50] convert binfmt_misc Al Viro
2025-10-28 0:45 ` [PATCH v2 33/50] selinuxfs: don't stash the dentry of /policy_capabilities Al Viro
2025-10-29 0:08 ` Paul Moore
2025-10-29 15:19 ` Stephen Smalley
2025-10-28 0:45 ` [PATCH v2 34/50] selinuxfs: new helper for attaching files to tree Al Viro
2025-10-28 23:51 ` Paul Moore
2025-10-29 15:22 ` Stephen Smalley
2025-10-28 0:45 ` [PATCH v2 35/50] convert selinuxfs Al Viro
2025-10-29 0:02 ` Paul Moore
2025-10-29 3:24 ` Al Viro
2025-10-29 14:49 ` Paul Moore
2025-10-29 15:06 ` Stephen Smalley
2025-10-28 0:45 ` [PATCH v2 36/50] functionfs: switch to simple_remove_by_name() Al Viro
2025-10-28 8:47 ` Greg KH
2025-10-28 0:45 ` [PATCH v2 37/50] convert functionfs Al Viro
2025-10-28 0:45 ` [PATCH v2 38/50] gadgetfs: switch to simple_remove_by_name() Al Viro
2025-10-28 0:45 ` [PATCH v2 39/50] convert gadgetfs Al Viro
2025-10-28 0:45 ` [PATCH v2 40/50] hypfs: don't pin dentries twice Al Viro
2025-10-28 0:46 ` Al Viro [this message]
2025-10-28 0:46 ` [PATCH v2 42/50] hypfs: swich hypfs_create_u64() to returning int Al Viro
2025-10-28 0:46 ` [PATCH v2 43/50] convert hypfs Al Viro
2025-10-28 0:46 ` [PATCH v2 44/50] convert rpc_pipefs Al Viro
2025-10-28 0:46 ` [PATCH v2 45/50] convert nfsctl Al Viro
2025-10-28 0:46 ` [PATCH v2 46/50] convert rust_binderfs Al Viro
2025-10-28 0:46 ` [PATCH v2 47/50] get rid of kill_litter_super() Al Viro
2025-10-28 0:46 ` [PATCH v2 48/50] convert securityfs Al Viro
2025-10-29 0:10 ` Paul Moore
2025-10-28 0:46 ` [PATCH v2 49/50] kill securityfs_recursive_remove() Al Viro
2025-10-29 0:04 ` Paul Moore
2025-10-28 0:46 ` [PATCH v2 50/50] d_make_discardable(): warn if given a non-persistent dentry Al Viro
2025-10-28 0:59 ` [PATCH v2 00/50] tree-in-dcache stuff Al Viro
2025-10-28 5:33 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251028004614.393374-42-viro@zeniv.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=a.hindborg@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=casey@schaufler-ca.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=john.johansen@canonical.com \
--cc=kees@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=miklos@szeredi.hu \
--cc=neil@brown.name \
--cc=ocfs2-devel@lists.linux.dev \
--cc=paul@paul-moore.com \
--cc=raven@themaw.net \
--cc=rostedt@goodmis.org \
--cc=selinux@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox