kernel: main: Add panic if thread creation fails
Add check for thread creation and panic if it fails.
Change-Id: I1960dc2ba9496b602dad30402150e7035522077d
diff --git a/kernel/dpc.c b/kernel/dpc.c
index 184ac31..dd70b96 100644
--- a/kernel/dpc.c
+++ b/kernel/dpc.c
@@ -42,9 +42,16 @@
void dpc_init(void)
{
+ thread_t *thr;
+
event_init(&dpc_event, false, 0);
- thread_resume(thread_create("dpc", &dpc_thread_routine, NULL, DPC_PRIORITY, DEFAULT_STACK_SIZE));
+ thr = thread_create("dpc", &dpc_thread_routine, NULL, DPC_PRIORITY, DEFAULT_STACK_SIZE);
+ if (!thr)
+ {
+ panic("failed to create dpc thread\n");
+ }
+ thread_resume(thr);
}
status_t dpc_queue(dpc_callback cb, void *arg, uint flags)