loopback driver use the send_count variable to know the test progress.
The test may be stopped or change but this variable is never cleaned.
Such situation may break the next run.
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
        u64 elapsed_nsecs;
        u32 apbridge_latency_ts;
        u32 gpbridge_latency_ts;
+
+       u32 send_count;
 };
 
 static struct class loopback_class = {
        gb->requests_timedout = 0;
        gb->requests_completed = 0;
        gb->iteration_count = 0;
+       gb->send_count = 0;
        gb->error = 0;
 
        if (kfifo_depth < gb->iteration_max) {
        int us_wait = 0;
        int type;
        u32 size;
-       u32 send_count = 0;
+
        struct gb_loopback *gb = data;
 
        while (1) {
                mutex_lock(&gb->mutex);
 
                /* Optionally terminate */
-               if (send_count == gb->iteration_max) {
+               if (gb->send_count == gb->iteration_max) {
                        if (gb->iteration_count == gb->iteration_max) {
                                gb->type = 0;
-                               send_count = 0;
+                               gb->send_count = 0;
                                sysfs_notify(&gb->dev->kobj,  NULL,
                                                "iteration_count");
                        }
                        gb->iteration_count++;
                        gb_loopback_calculate_stats(gb, !!error);
                }
-               send_count++;
+               gb->send_count++;
                if (us_wait)
                        udelay(us_wait);
        }