Skip to contentSkip to conversation

nvmet: free workqueue object if module init fails

PATCH Superseded Chaitanya Kulkarni 2 participants 3 messages Aug 16, 2018 – Aug 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvmet: free workqueue object if module init fails

Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>

---
Changes since V1:-

1. Add a separate goto for freeing workqueue.

---
 drivers/nvme/target/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/nvme/target/core.c +5 -3
index 4b9758f13a83..dfd214390163 100644
@@ -1210,7 +1210,7 @@ static int __init nvmet_init(void)
 
 	error = nvmet_init_discovery();
 	if (error)
-		goto out;
+		goto out_free_work_queue;
 
 	error = nvmet_init_configfs();
 	if (error)
@@ -1219,9 +1219,11 @@ static int __init nvmet_init(void)
 
 out_exit_discovery:
 	nvmet_exit_discovery();
+
+out_free_work_queue:
+	destroy_workqueue(buffered_io_wq);
+
 out:
-	if (buffered_io_wq)
-		destroy_workqueue(buffered_io_wq);
 	return error;
 }
 
Signature · 1 line
2.17.0
#1 lore raw

PATCH v2 1/1 nvmet: free workqueue object if module init fails

Looks good, but I had to apply this manually as the context didn't match what is upstream. Please double check that I didn't mess it up.

#2 lore raw

PATCH v2 1/1 nvmet: free workqueue object if module init fails

Thanks Christoph, everything looks good.

On 8/22/18, 6:05 AM, "Christoph Hellwig" <[email protected]> wrote:

Looks good, but I had to apply this manually as the context didn't match what is upstream. Please double check that I didn't mess it up.