From c9b43e0245f113e38ab476b44edde8bf7129099d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 21 Jul 2019 01:49:03 +0000 Subject: [PATCH] scst: Fix an error path in scst_tgt_dev_setup_threads() git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8464 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 5240729f3..20a7ffe8c 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -5229,10 +5229,8 @@ int scst_tgt_dev_setup_threads(struct scst_tgt_dev *tgt_dev) res = scst_add_threads(tgt_dev->active_cmd_threads, NULL, tgt_dev, dev->threads_num + tgtt->threads_num); - if (res != 0) { - /* Let's clear here, because no threads could be run */ - tgt_dev->active_cmd_threads->io_context = NULL; - } + if (res != 0) + scst_deinit_threads(&tgt_dev->tgt_dev_cmd_threads); break; } case SCST_THREADS_POOL_SHARED: @@ -5254,6 +5252,8 @@ int scst_tgt_dev_setup_threads(struct scst_tgt_dev *tgt_dev) out: if (res == 0) tm_dbg_init_tgt_dev(tgt_dev); + else + tgt_dev->active_cmd_threads->io_context = NULL; TRACE_EXIT_RES(res); return res;