struct srp_host *host =
                container_of(dev, struct srp_host, dev);
 
-       complete(&host->released);
+       kfree(host);
 }
 
 static struct class srp_class = {
 
        INIT_LIST_HEAD(&host->target_list);
        spin_lock_init(&host->target_lock);
-       init_completion(&host->released);
        mutex_init(&host->add_target_mutex);
        host->srp_dev = device;
        host->port = port;
 put_host:
        device_del(&host->dev);
        put_device(&host->dev);
-       kfree(host);
-
        return NULL;
 }
 
        srp_dev = client_data;
 
        list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
-               device_unregister(&host->dev);
                /*
-                * Wait for the sysfs entry to go away, so that no new
-                * target ports can be created.
+                * Remove the add_target sysfs entry so that no new target ports
+                * can be created.
                 */
-               wait_for_completion(&host->released);
+               device_del(&host->dev);
 
                /*
                 * Remove all target ports.
                 */
                flush_workqueue(srp_remove_wq);
 
-               kfree(host);
+               put_device(&host->dev);
        }
 
        ib_dealloc_pd(srp_dev->pd);