From 1db47d2a3ea3ee76534f17dd9da2578ede635943 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Sat, 23 Jul 2022 18:39:21 +0300 Subject: [PATCH] scst_main: Fix up the error handling We should clear sysfs during copy manager device registration failure. Otherwise, we will not be able to re-register this device, since the sysfs for it has already been created. --- scst/src/scst_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 2aa991432..7ad113cea 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -1356,8 +1356,10 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, list_add_tail(&dev->dev_list_entry, &scst_dev_list); res = scst_cm_on_dev_register(dev); - if (res != 0) + if (res != 0) { + sysfs_del = true; goto out_unreg; + } mutex_unlock(&scst_mutex);