summaryrefslogtreecommitdiff
path: root/net/ceph
diff options
context:
space:
mode:
authorGuo Zhengkui <guozhengkui@vivo.com>2022-04-12 14:46:20 +0800
committerIlya Dryomov <idryomov@gmail.com>2022-05-25 20:45:13 +0200
commitd9d58f0402a8bd14b980e6f41a5aa28aa0ca0e04 (patch)
treeda3d16d9aee9562df180697757e4674a7ebce1ce /net/ceph
parent261998c30004f0e6eeddd24b1eb5e504cfacee18 (diff)
libceph: use swap() macro instead of taking tmp variable
Fix the following coccicheck warning: net/ceph/crush/mapper.c:1077:8-9: WARNING opportunity for swap() by using swap() for the swapping of variable values and drop the tmp variable that is not needed any more. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/crush/mapper.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
index 7057f8db4f99..1daf95e17d67 100644
--- a/net/ceph/crush/mapper.c
+++ b/net/ceph/crush/mapper.c
@@ -906,7 +906,6 @@ int crush_do_rule(const struct crush_map *map,
int recurse_to_leaf;
int wsize = 0;
int osize;
- int *tmp;
const struct crush_rule *rule;
__u32 step;
int i, j;
@@ -1073,9 +1072,7 @@ int crush_do_rule(const struct crush_map *map,
memcpy(o, c, osize*sizeof(*o));
/* swap o and w arrays */
- tmp = o;
- o = w;
- w = tmp;
+ swap(o, w);
wsize = osize;
break;