kernel: main: Add panic if thread creation fails

Add check for thread creation and panic if it fails.

Change-Id: I1960dc2ba9496b602dad30402150e7035522077d
diff --git a/dev/vib/vibrator.c b/dev/vib/vibrator.c
index 03b7a87..cc47b24 100644
--- a/dev/vib/vibrator.c
+++ b/dev/vib/vibrator.c
@@ -90,6 +90,10 @@
  */
 void vib_timed_turn_on(const uint32_t vibrate_time)
 {
+#if USE_VIB_THREAD
+	thread_t *thr;
+#endif
+
 	if(!vib_timeout){
 		dprintf(CRITICAL,"vibrator already turn on\n");
 		return;
@@ -101,8 +105,14 @@
 	timer_set_oneshot(&vib_timer, vibrate_time, vib_timer_func, NULL);
 #else
 	vib_time = (vibrate_time/CHECK_VIB_TIMER_FREQUENCY)+1;
-	thread_resume(thread_create("vibrator_thread", &vibrator_thread,
-			NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE));
+	thread_create("vibrator_thread", &vibrator_thread,
+			NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
+	if (!thr)
+	{
+		panic("failed to create vibrator thread\n");
+	}
+	thread_resume(thr);
+
 #endif
 }