[lvc-project] [PATCH 4/6] [v3] wifi: ath10k: do not ignore possible dma_alloc_coherent() error

Jeff Johnson quic_jjohnson at quicinc.com
Thu Aug 24 18:27:29 MSK 2023


On 8/23/2023 10:51 PM, Dmitry Antipov wrote:
> Change 'ath10k_ce_alloc_rri()' to return -ENOMEM in case
> of 'dma_alloc_coherent()' failure and fix error handling in
> 'ath10k_snoc_hif_power_up()'.
> 
> Signed-off-by: Dmitry Antipov <dmantipov at yandex.ru>

Acked-by: Jeff Johnson <quic_jjohnson at quicinc.com>

> ---
> v3: split from the larger v2 patch
> ---
>   drivers/net/wireless/ath/ath10k/ce.c   | 6 ++++--
>   drivers/net/wireless/ath/ath10k/ce.h   | 2 +-
>   drivers/net/wireless/ath/ath10k/snoc.c | 9 ++++++++-
>   3 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
> index 73aa3632b23c..d7275dcc1f99 100644
> --- a/drivers/net/wireless/ath/ath10k/ce.c
> +++ b/drivers/net/wireless/ath/ath10k/ce.c
> @@ -1906,7 +1906,7 @@ int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id,
>   }
>   EXPORT_SYMBOL(ath10k_ce_alloc_pipe);
>   
> -void ath10k_ce_alloc_rri(struct ath10k *ar)
> +int ath10k_ce_alloc_rri(struct ath10k *ar)
>   {
>   	int i;
>   	u32 value;
> @@ -1919,7 +1919,7 @@ void ath10k_ce_alloc_rri(struct ath10k *ar)
>   					   &ce->paddr_rri, GFP_KERNEL);
>   
>   	if (!ce->vaddr_rri)
> -		return;
> +		return -ENOMEM;
>   
>   	ath10k_ce_write32(ar, ar->hw_ce_regs->ce_rri_low,
>   			  lower_32_bits(ce->paddr_rri));
> @@ -1934,6 +1934,8 @@ void ath10k_ce_alloc_rri(struct ath10k *ar)
>   		value |= ar->hw_ce_regs->upd->mask;
>   		ath10k_ce_write32(ar, ce_base_addr + ctrl1_regs, value);
>   	}
> +
> +	return 0;
>   }
>   EXPORT_SYMBOL(ath10k_ce_alloc_rri);
>   
> diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
> index a0b408176f7f..c90c00316356 100644
> --- a/drivers/net/wireless/ath/ath10k/ce.h
> +++ b/drivers/net/wireless/ath/ath10k/ce.h
> @@ -262,7 +262,7 @@ void ath10k_ce_enable_interrupts(struct ath10k *ar);
>   void ath10k_ce_dump_registers(struct ath10k *ar,
>   			      struct ath10k_fw_crash_data *crash_data);
>   
> -void ath10k_ce_alloc_rri(struct ath10k *ar);
> +int ath10k_ce_alloc_rri(struct ath10k *ar);
>   void ath10k_ce_free_rri(struct ath10k *ar);
>   
>   /* ce_attr.flags values */
> diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
> index 815df15f58fb..b3acb6ad6f45 100644
> --- a/drivers/net/wireless/ath/ath10k/snoc.c
> +++ b/drivers/net/wireless/ath/ath10k/snoc.c
> @@ -1074,10 +1074,17 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar,
>   		goto err_hw_power_off;
>   	}
>   
> -	ath10k_ce_alloc_rri(ar);
> +	ret = ath10k_ce_alloc_rri(ar);
> +	if (ret)
> +		goto err_snoc_wlan_disable;
>   
>   	ath10k_snoc_init_pipes(ar);
>   
> +	return 0;
> +
> +err_snoc_wlan_disable:
> +	ath10k_snoc_wlan_disable(ar);
> +
>   err_hw_power_off:
>   	ath10k_hw_power_off(ar);
>   




More information about the lvc-project mailing list