@@ -3473,25 +3473,60 @@ int ath10k_pci_setup_resource(struct ath10k *ar)
3473
3473
3474
3474
timer_setup (& ar_pci -> rx_post_retry , ath10k_pci_rx_replenish_retry , 0 );
3475
3475
3476
+ ar_pci -> attr = kmemdup (pci_host_ce_config_wlan ,
3477
+ sizeof (pci_host_ce_config_wlan ),
3478
+ GFP_KERNEL );
3479
+ if (!ar_pci -> attr )
3480
+ return - ENOMEM ;
3481
+
3482
+ ar_pci -> pipe_config = kmemdup (pci_target_ce_config_wlan ,
3483
+ sizeof (pci_target_ce_config_wlan ),
3484
+ GFP_KERNEL );
3485
+ if (!ar_pci -> pipe_config ) {
3486
+ ret = - ENOMEM ;
3487
+ goto err_free_attr ;
3488
+ }
3489
+
3490
+ ar_pci -> serv_to_pipe = kmemdup (pci_target_service_to_ce_map_wlan ,
3491
+ sizeof (pci_target_service_to_ce_map_wlan ),
3492
+ GFP_KERNEL );
3493
+ if (!ar_pci -> serv_to_pipe ) {
3494
+ ret = - ENOMEM ;
3495
+ goto err_free_pipe_config ;
3496
+ }
3497
+
3476
3498
if (QCA_REV_6174 (ar ) || QCA_REV_9377 (ar ))
3477
3499
ath10k_pci_override_ce_config (ar );
3478
3500
3479
3501
ret = ath10k_pci_alloc_pipes (ar );
3480
3502
if (ret ) {
3481
3503
ath10k_err (ar , "failed to allocate copy engine pipes: %d\n" ,
3482
3504
ret );
3483
- return ret ;
3505
+ goto err_free_serv_to_pipe ;
3484
3506
}
3485
3507
3486
3508
return 0 ;
3509
+
3510
+ err_free_serv_to_pipe :
3511
+ kfree (ar_pci -> serv_to_pipe );
3512
+ err_free_pipe_config :
3513
+ kfree (ar_pci -> pipe_config );
3514
+ err_free_attr :
3515
+ kfree (ar_pci -> attr );
3516
+ return ret ;
3487
3517
}
3488
3518
3489
3519
void ath10k_pci_release_resource (struct ath10k * ar )
3490
3520
{
3521
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
3522
+
3491
3523
ath10k_pci_rx_retry_sync (ar );
3492
3524
netif_napi_del (& ar -> napi );
3493
3525
ath10k_pci_ce_deinit (ar );
3494
3526
ath10k_pci_free_pipes (ar );
3527
+ kfree (ar_pci -> attr );
3528
+ kfree (ar_pci -> pipe_config );
3529
+ kfree (ar_pci -> serv_to_pipe );
3495
3530
}
3496
3531
3497
3532
static const struct ath10k_bus_ops ath10k_pci_bus_ops = {
@@ -3601,30 +3636,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3601
3636
3602
3637
timer_setup (& ar_pci -> ps_timer , ath10k_pci_ps_timer , 0 );
3603
3638
3604
- ar_pci -> attr = kmemdup (pci_host_ce_config_wlan ,
3605
- sizeof (pci_host_ce_config_wlan ),
3606
- GFP_KERNEL );
3607
- if (!ar_pci -> attr ) {
3608
- ret = - ENOMEM ;
3609
- goto err_free ;
3610
- }
3611
-
3612
- ar_pci -> pipe_config = kmemdup (pci_target_ce_config_wlan ,
3613
- sizeof (pci_target_ce_config_wlan ),
3614
- GFP_KERNEL );
3615
- if (!ar_pci -> pipe_config ) {
3616
- ret = - ENOMEM ;
3617
- goto err_free ;
3618
- }
3619
-
3620
- ar_pci -> serv_to_pipe = kmemdup (pci_target_service_to_ce_map_wlan ,
3621
- sizeof (pci_target_service_to_ce_map_wlan ),
3622
- GFP_KERNEL );
3623
- if (!ar_pci -> serv_to_pipe ) {
3624
- ret = - ENOMEM ;
3625
- goto err_free ;
3626
- }
3627
-
3628
3639
ret = ath10k_pci_setup_resource (ar );
3629
3640
if (ret ) {
3630
3641
ath10k_err (ar , "failed to setup resource: %d\n" , ret );
@@ -3705,10 +3716,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3705
3716
3706
3717
err_free_irq :
3707
3718
ath10k_pci_free_irq (ar );
3708
- ath10k_pci_rx_retry_sync (ar );
3709
3719
3710
3720
err_deinit_irq :
3711
- ath10k_pci_deinit_irq (ar );
3721
+ ath10k_pci_release_resource (ar );
3712
3722
3713
3723
err_sleep :
3714
3724
ath10k_pci_sleep_sync (ar );
@@ -3720,39 +3730,25 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3720
3730
err_core_destroy :
3721
3731
ath10k_core_destroy (ar );
3722
3732
3723
- err_free :
3724
- kfree (ar_pci -> attr );
3725
- kfree (ar_pci -> pipe_config );
3726
- kfree (ar_pci -> serv_to_pipe );
3727
-
3728
3733
return ret ;
3729
3734
}
3730
3735
3731
3736
static void ath10k_pci_remove (struct pci_dev * pdev )
3732
3737
{
3733
3738
struct ath10k * ar = pci_get_drvdata (pdev );
3734
- struct ath10k_pci * ar_pci ;
3735
3739
3736
3740
ath10k_dbg (ar , ATH10K_DBG_PCI , "pci remove\n" );
3737
3741
3738
3742
if (!ar )
3739
3743
return ;
3740
3744
3741
- ar_pci = ath10k_pci_priv (ar );
3742
-
3743
- if (!ar_pci )
3744
- return ;
3745
-
3746
3745
ath10k_core_unregister (ar );
3747
3746
ath10k_pci_free_irq (ar );
3748
3747
ath10k_pci_deinit_irq (ar );
3749
3748
ath10k_pci_release_resource (ar );
3750
3749
ath10k_pci_sleep_sync (ar );
3751
3750
ath10k_pci_release (ar );
3752
3751
ath10k_core_destroy (ar );
3753
- kfree (ar_pci -> attr );
3754
- kfree (ar_pci -> pipe_config );
3755
- kfree (ar_pci -> serv_to_pipe );
3756
3752
}
3757
3753
3758
3754
MODULE_DEVICE_TABLE (pci , ath10k_pci_id_table );
0 commit comments