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);