[PATCH] um: Use swap() instead of open coding it

From: Jiapeng Chong
Date: Tue Nov 21 2023 - 22:25:30 EST


Swap is a function interface that provides exchange function. To avoid
code duplication, we can use swap function.

./arch/um/os-Linux/sigio.c:81:28-29: WARNING opportunity for swap().

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7607
Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
---
arch/um/os-Linux/sigio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 9e71794839e8..1eb15f3cfdc8 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -50,7 +50,7 @@ static struct pollfds all_sigio_fds;

static int write_sigio_thread(void *unused)
{
- struct pollfds *fds, tmp;
+ struct pollfds *fds;
struct pollfd *p;
int i, n, respond_fd;
char c;
@@ -77,9 +77,7 @@ static int write_sigio_thread(void *unused)
"write_sigio_thread : "
"read on socket failed, "
"err = %d\n", errno);
- tmp = current_poll;
- current_poll = next_poll;
- next_poll = tmp;
+ swap(current_poll, next_poll);
respond_fd = sigio_private[1];
}
else {
--
2.20.1.7.g153144c