@@ -454,7 +454,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
454
454
ha -> req_q_map [0 ] = req ;
455
455
set_bit (0 , ha -> rsp_qid_map );
456
456
set_bit (0 , ha -> req_qid_map );
457
- return 1 ;
457
+ return 0 ;
458
458
459
459
fail_qpair_map :
460
460
kfree (ha -> base_qpair );
@@ -471,6 +471,9 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
471
471
472
472
static void qla2x00_free_req_que (struct qla_hw_data * ha , struct req_que * req )
473
473
{
474
+ if (!ha -> req_q_map )
475
+ return ;
476
+
474
477
if (IS_QLAFX00 (ha )) {
475
478
if (req && req -> ring_fx00 )
476
479
dma_free_coherent (& ha -> pdev -> dev ,
@@ -481,14 +484,17 @@ static void qla2x00_free_req_que(struct qla_hw_data *ha, struct req_que *req)
481
484
(req -> length + 1 ) * sizeof (request_t ),
482
485
req -> ring , req -> dma );
483
486
484
- if (req )
487
+ if (req ) {
485
488
kfree (req -> outstanding_cmds );
486
-
487
- kfree ( req );
489
+ kfree ( req );
490
+ }
488
491
}
489
492
490
493
static void qla2x00_free_rsp_que (struct qla_hw_data * ha , struct rsp_que * rsp )
491
494
{
495
+ if (!ha -> rsp_q_map )
496
+ return ;
497
+
492
498
if (IS_QLAFX00 (ha )) {
493
499
if (rsp && rsp -> ring )
494
500
dma_free_coherent (& ha -> pdev -> dev ,
@@ -499,7 +505,8 @@ static void qla2x00_free_rsp_que(struct qla_hw_data *ha, struct rsp_que *rsp)
499
505
(rsp -> length + 1 ) * sizeof (response_t ),
500
506
rsp -> ring , rsp -> dma );
501
507
}
502
- kfree (rsp );
508
+ if (rsp )
509
+ kfree (rsp );
503
510
}
504
511
505
512
static void qla2x00_free_queues (struct qla_hw_data * ha )
@@ -1723,6 +1730,8 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
1723
1730
struct qla_tgt_cmd * cmd ;
1724
1731
uint8_t trace = 0 ;
1725
1732
1733
+ if (!ha -> req_q_map )
1734
+ return ;
1726
1735
spin_lock_irqsave (qp -> qp_lock_ptr , flags );
1727
1736
req = qp -> req ;
1728
1737
for (cnt = 1 ; cnt < req -> num_outstanding_cmds ; cnt ++ ) {
@@ -3095,14 +3104,14 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
3095
3104
/* Set up the irqs */
3096
3105
ret = qla2x00_request_irqs (ha , rsp );
3097
3106
if (ret )
3098
- goto probe_hw_failed ;
3107
+ goto probe_failed ;
3099
3108
3100
3109
/* Alloc arrays of request and response ring ptrs */
3101
- if (! qla2x00_alloc_queues (ha , req , rsp )) {
3110
+ if (qla2x00_alloc_queues (ha , req , rsp )) {
3102
3111
ql_log (ql_log_fatal , base_vha , 0x003d ,
3103
3112
"Failed to allocate memory for queue pointers..."
3104
3113
"aborting.\n" );
3105
- goto probe_init_failed ;
3114
+ goto probe_failed ;
3106
3115
}
3107
3116
3108
3117
if (ha -> mqenable && shost_use_blk_mq (host )) {
@@ -3387,15 +3396,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
3387
3396
3388
3397
return 0 ;
3389
3398
3390
- probe_init_failed :
3391
- qla2x00_free_req_que (ha , req );
3392
- ha -> req_q_map [0 ] = NULL ;
3393
- clear_bit (0 , ha -> req_qid_map );
3394
- qla2x00_free_rsp_que (ha , rsp );
3395
- ha -> rsp_q_map [0 ] = NULL ;
3396
- clear_bit (0 , ha -> rsp_qid_map );
3397
- ha -> max_req_queues = ha -> max_rsp_queues = 0 ;
3398
-
3399
3399
probe_failed :
3400
3400
if (base_vha -> timer_active )
3401
3401
qla2x00_stop_timer (base_vha );
@@ -4508,11 +4508,17 @@ qla2x00_mem_free(struct qla_hw_data *ha)
4508
4508
if (ha -> init_cb )
4509
4509
dma_free_coherent (& ha -> pdev -> dev , ha -> init_cb_size ,
4510
4510
ha -> init_cb , ha -> init_cb_dma );
4511
- vfree (ha -> optrom_buffer );
4512
- kfree (ha -> nvram );
4513
- kfree (ha -> npiv_info );
4514
- kfree (ha -> swl );
4515
- kfree (ha -> loop_id_map );
4511
+
4512
+ if (ha -> optrom_buffer )
4513
+ vfree (ha -> optrom_buffer );
4514
+ if (ha -> nvram )
4515
+ kfree (ha -> nvram );
4516
+ if (ha -> npiv_info )
4517
+ kfree (ha -> npiv_info );
4518
+ if (ha -> swl )
4519
+ kfree (ha -> swl );
4520
+ if (ha -> loop_id_map )
4521
+ kfree (ha -> loop_id_map );
4516
4522
4517
4523
ha -> srb_mempool = NULL ;
4518
4524
ha -> ctx_mempool = NULL ;
@@ -4528,6 +4534,15 @@ qla2x00_mem_free(struct qla_hw_data *ha)
4528
4534
ha -> ex_init_cb_dma = 0 ;
4529
4535
ha -> async_pd = NULL ;
4530
4536
ha -> async_pd_dma = 0 ;
4537
+ ha -> loop_id_map = NULL ;
4538
+ ha -> npiv_info = NULL ;
4539
+ ha -> optrom_buffer = NULL ;
4540
+ ha -> swl = NULL ;
4541
+ ha -> nvram = NULL ;
4542
+ ha -> mctp_dump = NULL ;
4543
+ ha -> dcbx_tlv = NULL ;
4544
+ ha -> xgmac_data = NULL ;
4545
+ ha -> sfp_data = NULL ;
4531
4546
4532
4547
ha -> s_dma_pool = NULL ;
4533
4548
ha -> dl_dma_pool = NULL ;
0 commit comments