Skip to content

Commit d9d58f0

Browse files
Guo Zhengkuiidryomov
authored andcommitted
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 <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 261998c commit d9d58f0

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

net/ceph/crush/mapper.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ int crush_do_rule(const struct crush_map *map,
906906
int recurse_to_leaf;
907907
int wsize = 0;
908908
int osize;
909-
int *tmp;
910909
const struct crush_rule *rule;
911910
__u32 step;
912911
int i, j;
@@ -1073,9 +1072,7 @@ int crush_do_rule(const struct crush_map *map,
10731072
memcpy(o, c, osize*sizeof(*o));
10741073

10751074
/* swap o and w arrays */
1076-
tmp = o;
1077-
o = w;
1078-
w = tmp;
1075+
swap(o, w);
10791076
wsize = osize;
10801077
break;
10811078

0 commit comments

Comments
 (0)