Commit 4e85f151 authored by Anil Veerabhadrappa's avatar Anil Veerabhadrappa Committed by James Bottomley

[SCSI] bnx2i: bug fixes in bnx2i_init_one to handle error conditions

Fixed bnx2i_init_one() to properly handle return code of
cnic->register_device() and propagate it back to the caller.  No need to check
for BNX2I_CNIC_REGISTERED, because unless the adapter is added to adapter_list
it will not be registered in ep_connect context
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarAnil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 1ed0f6a3
...@@ -267,22 +267,29 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic) ...@@ -267,22 +267,29 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)
int rc; int rc;
read_lock(&bnx2i_dev_lock); read_lock(&bnx2i_dev_lock);
if (!test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) {
rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba); rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba);
if (rc) /* duplicate registration */ if (!rc) {
printk(KERN_ERR "bnx2i- dev reg failed\n");
hba->age++; hba->age++;
set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic);
} } else if (rc == -EBUSY) /* duplicate registration */
printk(KERN_ALERT "bnx2i, duplicate registration"
"hba=%p, cnic=%p\n", hba, cnic);
else if (rc == -EAGAIN)
printk(KERN_ERR "bnx2i, driver not registered\n");
else if (rc == -EINVAL)
printk(KERN_ERR "bnx2i, invalid type %d\n", CNIC_ULP_ISCSI);
else
printk(KERN_ERR "bnx2i dev reg, unknown error, %d\n", rc);
read_unlock(&bnx2i_dev_lock); read_unlock(&bnx2i_dev_lock);
if (!rc) {
write_lock(&bnx2i_dev_lock); write_lock(&bnx2i_dev_lock);
list_add_tail(&hba->link, &adapter_list); list_add_tail(&hba->link, &adapter_list);
adapter_count++; adapter_count++;
write_unlock(&bnx2i_dev_lock); write_unlock(&bnx2i_dev_lock);
return 0; }
return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment