diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 1ea4fa4a5..ee599fad6 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3510,6 +3510,10 @@ static void srpt_add_one(struct ib_device *device) if (!sdev) goto err; + sdev->device = device; + INIT_LIST_HEAD(&sdev->rch_list); + spin_lock_init(&sdev->spinlock); + sdev->scst_tgt = scst_register_target(&srpt_template, NULL); if (!sdev->scst_tgt) { PRINT_ERROR("SCST registration failed for %s.", @@ -3519,8 +3523,6 @@ static void srpt_add_one(struct ib_device *device) scst_tgt_set_tgt_priv(sdev->scst_tgt, sdev); - sdev->device = device; - sdev->dev.class = &srpt_class; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) sdev->dev.dev = device->dma_device; @@ -3602,9 +3604,6 @@ static void srpt_add_one(struct ib_device *device) if (!sdev->ioctx_ring) goto err_event; - INIT_LIST_HEAD(&sdev->rch_list); - spin_lock_init(&sdev->spinlock); - for (i = 0; i < sdev->srq_size; ++i) srpt_post_recv(sdev, sdev->ioctx_ring[i]);