UPSTREAM: 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> Signed-off-by: Sorayukii <sorayukii69@gmail.com>
This commit is contained in:
parent
5151d6a14a
commit
cdf72ec34d
1 changed files with 9 additions and 14 deletions
23
fs/nsfs.c
23
fs/nsfs.c
|
|
@ -105,17 +105,14 @@ 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);
|
||||
|
||||
ret = __ns_get_path(path, ns);
|
||||
if (IS_ERR(ret) && PTR_ERR(ret) == -EAGAIN)
|
||||
goto again;
|
||||
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));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +147,7 @@ static int open_related_ns(struct ns_common *ns,
|
|||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
struct ns_common *relative;
|
||||
|
||||
relative = get_ns(ns);
|
||||
|
|
@ -160,10 +157,8 @@ static 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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue