diff options
| author | Changcheng Deng <[email protected]> | 2021-11-05 20:39:56 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2021-11-06 20:30:37 +0000 |
| commit | 34b46efd6ec6a6f2d6a57be4216b820c879a0030 (patch) | |
| tree | 008f0c70c28dd13f111f9e194d32e09392ceb502 /lib/test_vmalloc.c | |
| parent | mm/vmalloc: introduce alloc_pages_bulk_array_mempolicy to accelerate memory a... (diff) | |
| download | kernel-34b46efd6ec6a6f2d6a57be4216b820c879a0030.tar.gz kernel-34b46efd6ec6a6f2d6a57be4216b820c879a0030.zip | |
lib/test_vmalloc.c: use swap() to make code cleaner
Use swap() in order to make code cleaner. Issue found by coccinelle.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Changcheng Deng <[email protected]>
Reported-by: Zeal Robot <[email protected]>
Reviewed-by: Uladzislau Rezki (Sony) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/test_vmalloc.c')
| -rw-r--r-- | lib/test_vmalloc.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c index e14993bc84d2..cf41fd6df42a 100644 --- a/lib/test_vmalloc.c +++ b/lib/test_vmalloc.c @@ -393,7 +393,7 @@ static struct test_driver { static void shuffle_array(int *arr, int n) { unsigned int rnd; - int i, j, x; + int i, j; for (i = n - 1; i > 0; i--) { get_random_bytes(&rnd, sizeof(rnd)); @@ -402,9 +402,7 @@ static void shuffle_array(int *arr, int n) j = rnd % i; /* Swap indexes. */ - x = arr[i]; - arr[i] = arr[j]; - arr[j] = x; + swap(arr[i], arr[j]); } } |
