summaryrefslogtreecommitdiff
path: root/fs/nsfs.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-03-22 23:26:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-04-09 19:20:57 -0400
commit357ab5b5d240a284b261a62451e838dd9f76e6b9 (patch)
treee3a01e4efc93cf14a81bcf0e532a9b492f3767a8 /fs/nsfs.c
parentab1152dd5650d35da6f0f6d3c0cc18f86fdc0725 (diff)
downloadlwn-357ab5b5d240a284b261a62451e838dd9f76e6b9.tar.gz
lwn-357ab5b5d240a284b261a62451e838dd9f76e6b9.zip
nsfs: unobfuscate
1) IS_ERR(p) && PTR_ERR(p) == -E... is spelled p == ERR_PTR(-E...) 2) yes, you can open-code do-while and sometimes there's even a good reason to do so. Not in this case, though. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nsfs.c')
-rw-r--r--fs/nsfs.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 30d150a4f0c6..e3bf08c5af41 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -105,17 +105,16 @@ slow:
void *ns_get_path_cb(struct path *path, ns_get_path_helper_t *ns_get_cb,
void *private_data)
{
- struct ns_common *ns;
void *ret;
-again:
- ns = ns_get_cb(private_data);
- if (!ns)
- return ERR_PTR(-ENOENT);
+ do {
+ struct ns_common *ns = ns_get_cb(private_data);
+ if (!ns)
+ return ERR_PTR(-ENOENT);
+
+ ret = __ns_get_path(path, ns);
+ } while (ret == ERR_PTR(-EAGAIN));
- ret = __ns_get_path(path, ns);
- if (IS_ERR(ret) && PTR_ERR(ret) == -EAGAIN)
- goto again;
return ret;
}
@@ -154,7 +153,7 @@ int open_related_ns(struct ns_common *ns,
if (fd < 0)
return fd;
- while (1) {
+ do {
struct ns_common *relative;
relative = get_ns(ns);
@@ -164,10 +163,8 @@ int open_related_ns(struct ns_common *ns,
}
err = __ns_get_path(&path, relative);
- if (IS_ERR(err) && PTR_ERR(err) == -EAGAIN)
- continue;
- break;
- }
+ } while (err == ERR_PTR(-EAGAIN));
+
if (IS_ERR(err)) {
put_unused_fd(fd);
return PTR_ERR(err);