aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c7
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index fd78540ffc9..0c4210d48ee 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -185,14 +185,17 @@ void bnx2i_stop(void *handle)
185 */ 185 */
186void bnx2i_register_device(struct bnx2i_hba *hba) 186void bnx2i_register_device(struct bnx2i_hba *hba)
187{ 187{
188 int rc;
189
188 if (test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state) || 190 if (test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state) ||
189 test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { 191 test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) {
190 return; 192 return;
191 } 193 }
192 194
193 hba->cnic->register_device(hba->cnic, CNIC_ULP_ISCSI, hba); 195 rc = hba->cnic->register_device(hba->cnic, CNIC_ULP_ISCSI, hba);
194 196
195 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); 197 if (!rc)
198 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic);
196} 199}
197 200
198 201
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index f7412196f2f..98148f3f3c6 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1653,15 +1653,18 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
1653 struct iscsi_endpoint *ep; 1653 struct iscsi_endpoint *ep;
1654 int rc = 0; 1654 int rc = 0;
1655 1655
1656 if (shost) 1656 if (shost) {
1657 /* driver is given scsi host to work with */ 1657 /* driver is given scsi host to work with */
1658 hba = iscsi_host_priv(shost); 1658 hba = iscsi_host_priv(shost);
1659 else 1659 /* Register the device with cnic if not already done so */
1660 bnx2i_register_device(hba);
1661 } else
1660 /* 1662 /*
1661 * check if the given destination can be reached through 1663 * check if the given destination can be reached through
1662 * a iscsi capable NetXtreme2 device 1664 * a iscsi capable NetXtreme2 device
1663 */ 1665 */
1664 hba = bnx2i_check_route(dst_addr); 1666 hba = bnx2i_check_route(dst_addr);
1667
1665 if (!hba) { 1668 if (!hba) {
1666 rc = -ENOMEM; 1669 rc = -ENOMEM;
1667 goto check_busy; 1670 goto check_busy;