From 0bbb4bf3cdb17db8c37e292403f767d2b4e7a3a1 Mon Sep 17 00:00:00 2001 From: Anil Veerabhadrappa Date: Wed, 8 Jul 2009 18:21:01 -0700 Subject: [PATCH] --- yaml --- r: 160996 b: refs/heads/master c: fac3cc458fc2f8272bcc1ff1903474ff41715723 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/scsi/bnx2i/bnx2i_init.c | 7 +++++-- trunk/drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 485a9843e763..1932cb60273f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fe5d20c818a8c5fe83d9f2223a051fb5bc50d180 +refs/heads/master: fac3cc458fc2f8272bcc1ff1903474ff41715723 diff --git a/trunk/drivers/scsi/bnx2i/bnx2i_init.c b/trunk/drivers/scsi/bnx2i/bnx2i_init.c index fd78540ffc95..0c4210d48ee8 100644 --- a/trunk/drivers/scsi/bnx2i/bnx2i_init.c +++ b/trunk/drivers/scsi/bnx2i/bnx2i_init.c @@ -185,14 +185,17 @@ void bnx2i_stop(void *handle) */ void bnx2i_register_device(struct bnx2i_hba *hba) { + int rc; + if (test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state) || test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { return; } - hba->cnic->register_device(hba->cnic, CNIC_ULP_ISCSI, hba); + rc = hba->cnic->register_device(hba->cnic, CNIC_ULP_ISCSI, hba); - set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); + if (!rc) + set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); } diff --git a/trunk/drivers/scsi/bnx2i/bnx2i_iscsi.c b/trunk/drivers/scsi/bnx2i/bnx2i_iscsi.c index f7412196f2f8..98148f3f3c63 100644 --- a/trunk/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/trunk/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1653,15 +1653,18 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, struct iscsi_endpoint *ep; int rc = 0; - if (shost) + if (shost) { /* driver is given scsi host to work with */ hba = iscsi_host_priv(shost); - else + /* Register the device with cnic if not already done so */ + bnx2i_register_device(hba); + } else /* * check if the given destination can be reached through * a iscsi capable NetXtreme2 device */ hba = bnx2i_check_route(dst_addr); + if (!hba) { rc = -ENOMEM; goto check_busy;