From ee0328f6f72b45d0eb03d206a51a1fb57b111e70 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 13 May 2020 17:23:14 +0000 Subject: [PATCH] scst: Drop support for scst_register_target(..., NULL) Support for autogenerated target names was declared obsolete in 2011. Remove support for autogenerated target names. See also commit 21d503cbb7d1 ("Autogenerated SCST target names made deprecated"). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8904 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_main.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 21c1fd517..b6c37ee38 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -464,37 +464,18 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, TRACE_ENTRY(); + BUG_ON(!target_name); + rc = scst_alloc_tgt(vtt, &tgt); if (rc != 0) goto out; - if (target_name != NULL) { - - tgt->tgt_name = kstrdup(target_name, GFP_KERNEL); - if (tgt->tgt_name == NULL) { - PRINT_ERROR("Allocation of tgt name %s failed", - target_name); - rc = -ENOMEM; - goto out_free_tgt; - } - } else { - static int tgt_num; /* protected by scst_mutex */ - - PRINT_WARNING("Usage of autogenerated SCST target names " - "is deprecated and will be removed in one of the next " - "versions. It is strongly recommended to update target " - "driver %s to use hardware related persistent target " - "names instead", vtt->name); - - tgt->tgt_name = kasprintf(GFP_KERNEL, "%s%s%d", vtt->name, - SCST_DEFAULT_TGT_NAME_SUFFIX, tgt_num); - if (tgt->tgt_name == NULL) { - PRINT_ERROR("Allocation of tgt name failed " - "(template name %s)", vtt->name); - rc = -ENOMEM; - goto out_free_tgt; - } - tgt_num++; + tgt->tgt_name = kstrdup(target_name, GFP_KERNEL); + if (tgt->tgt_name == NULL) { + PRINT_ERROR("Allocation of tgt name %s failed", + target_name); + rc = -ENOMEM; + goto out_free_tgt; } rc = mutex_lock_interruptible(&scst_mutex);