diff --git a/sys/dev/drm/linux_workqueue.c b/sys/dev/drm/linux_workqueue.c --- a/sys/dev/drm/linux_workqueue.c +++ b/sys/dev/drm/linux_workqueue.c @@ -227,9 +227,16 @@ &worker->worker_thread, NULL, TDF_NOSTART, -1, name); } if (error) { + int j; kprintf("%s: lwkt_create(%s/%d): error %d", __func__, name, i, error); - /* XXX: destroy kernel threads and free workers[] if applicable */ + /* XXX: terminate already-created kernel threads */ + for (j = 0; j < i; j++) { + struct workqueue_worker *w = &(*wq->workers)[j]; + if (w->worker_thread != NULL) + wakeup(w->worker_thread); + } + kfree(wq->workers); kfree(wq); return NULL; }