Assign returned file descriptor directly to `fd', without intermediate
`ret' variable.

Signed-off-by: Sergei Zviagintsev <ser...@s15v.net>
---
 tools/testing/selftests/kdbus/kdbus-util.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/kdbus/kdbus-util.c 
b/tools/testing/selftests/kdbus/kdbus-util.c
index a3e49b04f3a7..f9102264cfb9 100644
--- a/tools/testing/selftests/kdbus/kdbus-util.c
+++ b/tools/testing/selftests/kdbus/kdbus-util.c
@@ -408,11 +408,9 @@ int sys_memfd_create(const char *name, __u64 size)
 {
        int ret, fd;
 
-       ret = syscall(__NR_memfd_create, name, MFD_ALLOW_SEALING);
-       if (ret < 0)
-               return ret;
-
-       fd = ret;
+       fd = syscall(__NR_memfd_create, name, MFD_ALLOW_SEALING);
+       if (fd < 0)
+               return fd;
 
        ret = ftruncate(fd, size);
        if (ret < 0) {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to