aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2i
diff options
context:
space:
mode:
authorAnil Veerabhadrappa <anilgv@broadcom.com>2009-06-23 17:04:23 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:51:52 -0400
commit4e85f15166a6a9da8317ddb8600b604b27e58aa3 (patch)
tree9cfdf0039631a1cd8d4c4e95d99f9148dc955a22 /drivers/scsi/bnx2i
parent1ed0f6a3ef94996341f3c5a2d4034ba1a2532b0a (diff)
[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: Michael Chan <mchan@broadcom.com> Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bnx2i')
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 269192d74372..2aeeeee3372d 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -267,22 +267,29 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)
267 int rc; 267 int rc;
268 268
269 read_lock(&bnx2i_dev_lock); 269 read_lock(&bnx2i_dev_lock);
270 if (!test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { 270 rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba);
271 rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba); 271 if (!rc) {
272 if (rc) /* duplicate registration */
273 printk(KERN_ERR "bnx2i- dev reg failed\n");
274
275 hba->age++; 272 hba->age++;
276
277 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); 273 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic);
278 } 274 } else if (rc == -EBUSY) /* duplicate registration */
275 printk(KERN_ALERT "bnx2i, duplicate registration"
276 "hba=%p, cnic=%p\n", hba, cnic);
277 else if (rc == -EAGAIN)
278 printk(KERN_ERR "bnx2i, driver not registered\n");
279 else if (rc == -EINVAL)
280 printk(KERN_ERR "bnx2i, invalid type %d\n", CNIC_ULP_ISCSI);
281 else
282 printk(KERN_ERR "bnx2i dev reg, unknown error, %d\n", rc);
279 read_unlock(&bnx2i_dev_lock); 283 read_unlock(&bnx2i_dev_lock);
280 284
281 write_lock(&bnx2i_dev_lock); 285 if (!rc) {
282 list_add_tail(&hba->link, &adapter_list); 286 write_lock(&bnx2i_dev_lock);
283 adapter_count++; 287 list_add_tail(&hba->link, &adapter_list);
284 write_unlock(&bnx2i_dev_lock); 288 adapter_count++;
285 return 0; 289 write_unlock(&bnx2i_dev_lock);
290 }
291
292 return rc;
286} 293}
287 294
288 295