diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c0e58f8..33b721a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5654,7 +5654,9 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
 		ret = apply_workqueue_attrs_locked(wq, unbound_std_wq_attrs[highpri]);
 	}
 
-	return ret;
+	if (ret)
+		goto enomem;
+	return 0;
 
 enomem:
 	if (wq->cpu_pwq) {
