treewide: use prandom_u32_max() when possible, part 1
[linux-block.git] / kernel / locking / test-ww_mutex.c
index 353004155d659fa271d0921bb454a2eb27ad1b8a..43efb2a0416025f9dc9ff4f89bbec416fd79d10a 100644 (file)
@@ -399,7 +399,7 @@ static int *get_random_order(int count)
                order[n] = n;
 
        for (n = count - 1; n > 1; n--) {
-               r = get_random_int() % (n + 1);
+               r = prandom_u32_max(n + 1);
                if (r != n) {
                        tmp = order[n];
                        order[n] = order[r];
@@ -538,7 +538,7 @@ static void stress_one_work(struct work_struct *work)
 {
        struct stress *stress = container_of(work, typeof(*stress), work);
        const int nlocks = stress->nlocks;
-       struct ww_mutex *lock = stress->locks + (get_random_int() % nlocks);
+       struct ww_mutex *lock = stress->locks + prandom_u32_max(nlocks);
        int err;
 
        do {