mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
23
fs/nsfs.c
23
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 *ns_get_path_cb(struct path *path, ns_get_path_helper_t *ns_get_cb,
|
||||||
void *private_data)
|
void *private_data)
|
||||||
{
|
{
|
||||||
struct ns_common *ns;
|
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
again:
|
do {
|
||||||
ns = ns_get_cb(private_data);
|
struct ns_common *ns = ns_get_cb(private_data);
|
||||||
if (!ns)
|
if (!ns)
|
||||||
return ERR_PTR(-ENOENT);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +153,7 @@ int open_related_ns(struct ns_common *ns,
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
while (1) {
|
do {
|
||||||
struct ns_common *relative;
|
struct ns_common *relative;
|
||||||
|
|
||||||
relative = get_ns(ns);
|
relative = get_ns(ns);
|
||||||
@@ -164,10 +163,8 @@ int open_related_ns(struct ns_common *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = __ns_get_path(&path, relative);
|
err = __ns_get_path(&path, relative);
|
||||||
if (IS_ERR(err) && PTR_ERR(err) == -EAGAIN)
|
} while (err == ERR_PTR(-EAGAIN));
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (IS_ERR(err)) {
|
if (IS_ERR(err)) {
|
||||||
put_unused_fd(fd);
|
put_unused_fd(fd);
|
||||||
return PTR_ERR(err);
|
return PTR_ERR(err);
|
||||||
|
Reference in New Issue
Block a user