summaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/host_command_fuzz.c6
-rw-r--r--fuzz/pchg_fuzz.c3
-rw-r--r--fuzz/span.h3
-rw-r--r--fuzz/usb_pd_fuzz.c14
4 files changed, 7 insertions, 19 deletions
diff --git a/fuzz/host_command_fuzz.c b/fuzz/host_command_fuzz.c
index 2875c687dd..0a648f602c 100644
--- a/fuzz/host_command_fuzz.c
+++ b/fuzz/host_command_fuzz.c
@@ -5,6 +5,9 @@
* Fuzz host command.
*/
+#include <pthread.h>
+#include <sys/time.h>
+
#include "builtin/assert.h"
#include "common.h"
#include "console.h"
@@ -16,9 +19,6 @@
#include "timer.h"
#include "util.h"
-#include <pthread.h>
-#include <sys/time.h>
-
/* Only test requests with valid size and checksum (makes fuzzing faster) */
#define VALID_REQUEST_ONLY
diff --git a/fuzz/pchg_fuzz.c b/fuzz/pchg_fuzz.c
index 06c94a2d83..4ef5f28b74 100644
--- a/fuzz/pchg_fuzz.c
+++ b/fuzz/pchg_fuzz.c
@@ -14,11 +14,10 @@
#include "timer.h"
#include "util.h"
+#include <pthread.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
-
#define TASK_EVENT_FUZZ TASK_EVENT_CUSTOM_BIT(0)
extern struct pchg_drv ctn730_drv;
diff --git a/fuzz/span.h b/fuzz/span.h
index de144efe60..9cb08f9461 100644
--- a/fuzz/span.h
+++ b/fuzz/span.h
@@ -5,9 +5,10 @@
#ifndef __FUZZ_SPAN_H
#define __FUZZ_SPAN_H
-#include <algorithm>
#include <unistd.h>
+#include <algorithm>
+
namespace fuzz
{
diff --git a/fuzz/usb_pd_fuzz.c b/fuzz/usb_pd_fuzz.c
index 809e09cdbb..bb462b9e61 100644
--- a/fuzz/usb_pd_fuzz.c
+++ b/fuzz/usb_pd_fuzz.c
@@ -13,11 +13,10 @@
#include "usb_pd_tcpm.h"
#include "util.h"
+#include <pthread.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
-
#define TASK_EVENT_FUZZ TASK_EVENT_CUSTOM_BIT(0)
#define PORT0 0
@@ -225,9 +224,7 @@ void run_test(int argc, const char **argv)
task_wait_event(50 * MSEC);
}
- pthread_mutex_lock(&lock);
pthread_cond_signal(&done_cond);
- pthread_mutex_unlock(&lock);
}
}
@@ -269,17 +266,8 @@ int test_fuzz_one_input(const uint8_t *data, unsigned int size)
return 0;
}
- pthread_mutex_init(&lock, NULL);
- pthread_cond_init(&done_cond, NULL);
-
task_set_event(TASK_ID_TEST_RUNNER, TASK_EVENT_FUZZ);
-
- pthread_mutex_lock(&lock);
pthread_cond_wait(&done_cond, &lock);
- pthread_mutex_unlock(&lock);
-
- pthread_cond_destroy(&done_cond);
- pthread_mutex_destroy(&lock);
return 0;
}