CLEANUP: task: remove unneeded tests before task_destroy()

Since previous commit it's not needed anymore to test a task pointer
before calling task_destory() so let's just remove these tests from
the various callers before they become confusing. The function's
arguments were also documented. The same should probably be done
with tasklet_free() which involves a test in roughly half of the
call places.
diff --git a/include/proto/task.h b/include/proto/task.h
index f167933..df9bc2a 100644
--- a/include/proto/task.h
+++ b/include/proto/task.h
@@ -329,6 +329,10 @@
 	_HA_ATOMIC_SUB(&nb_tasks, 1);
 }
 
+/* Destroys a task : it's unlinked from the wait queues and is freed if it's
+ * the current task or not queued otherwise it's marked to be freed by the
+ * scheduler. It does nothing if <t> is NULL.
+ */
 static inline void task_destroy(struct task *t)
 {
 	if (!t)
diff --git a/src/checks.c b/src/checks.c
index e6b0bd1..63d9e03 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -3303,10 +3303,7 @@
 		struct email_alertq *q     = &queues[i];
 		struct check        *check = &q->check;
 
-		if (check->task) {
-			task_destroy(check->task);
-			check->task = NULL;
-		}
+		task_destroy(check->task);
 		free_check(check);
 	}
 	free(queues);
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 2d70aff..75854b7 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1275,9 +1275,7 @@
 	}
 
 	/* Destroy the task attached to this applet */
-	if (spoe_appctx->task) {
-		task_destroy(spoe_appctx->task);
-	}
+	task_destroy(spoe_appctx->task);
 
 	/* Notify all waiting streams */
 	list_for_each_entry_safe(ctx, back, &spoe_appctx->waiting_queue, list) {
diff --git a/src/haproxy.c b/src/haproxy.c
index f709224..8ab0c2e 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2290,18 +2290,15 @@
 		while (s) {
 			s_next = s->next;
 
-			if (s->check.task)
-				task_destroy(s->check.task);
-			if (s->agent.task)
-				task_destroy(s->agent.task);
+			task_destroy(s->check.task);
+			task_destroy(s->agent.task);
 
 			if (s->check.wait_list.task)
 				tasklet_free(s->check.wait_list.task);
 			if (s->agent.wait_list.task)
 				tasklet_free(s->agent.wait_list.task);
 
-			if (s->warmup)
-				task_destroy(s->warmup);
+			task_destroy(s->warmup);
 
 			free(s->id);
 			free(s->cookie);
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 46bc33c..69a6e25 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -431,8 +431,7 @@
 	return 0;
 
   fail:
-	if (t)
-		task_destroy(t);
+	task_destroy(t);
 	if (h1c->wait_event.task)
 		tasklet_free(h1c->wait_event.task);
 	pool_free(pool_head_h1c, h1c);
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 6fb21dd..eca85cb 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -575,8 +575,7 @@
   fail_stream:
 	hpack_dht_free(h2c->ddht);
   fail:
-	if (t)
-		task_destroy(t);
+	task_destroy(t);
 	if (h2c->wait_event.task)
 		tasklet_free(h2c->wait_event.task);
 	pool_free(pool_head_h2c, h2c);
diff --git a/src/session.c b/src/session.c
index 875fae8..c77f1e9 100644
--- a/src/session.c
+++ b/src/session.c
@@ -448,11 +448,8 @@
 		goto fail;
 
 	/* the embryonic session's task is not needed anymore */
-	if (sess->task) {
-		task_destroy(sess->task);
-		sess->task = NULL;
-	}
-
+	task_destroy(sess->task);
+	sess->task = NULL;
 	conn_set_owner(conn, sess, conn_session_free);
 
 	return 0;