Re: [PATCH] ASoC: ti: davinci-mcasp: fix possible reference leak in __davinci_mcasp_set_clkdiv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 30/10/2020 17.36, Zhang Qilong wrote:
> pm_runtime_get_sync() will increment pm usage counter whatever it
> does. Forgetting to call pm_runtime_put will result in reference
> leak in __davinci_mcasp_set_clkdiv, so we should fix it.

Acked-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>

> Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx>
> ---
>  sound/soc/ti/davinci-mcasp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
> index a6b72ad53b43..4b46dd827f3f 100644
> --- a/sound/soc/ti/davinci-mcasp.c
> +++ b/sound/soc/ti/davinci-mcasp.c
> @@ -607,6 +607,8 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>  static int __davinci_mcasp_set_clkdiv(struct davinci_mcasp *mcasp, int div_id,
>  				      int div, bool explicit)
>  {
> +	int ret = 0;
> +
>  	pm_runtime_get_sync(mcasp->dev);
>  	switch (div_id) {
>  	case MCASP_CLKDIV_AUXCLK:			/* MCLK divider */
> @@ -644,11 +646,11 @@ static int __davinci_mcasp_set_clkdiv(struct davinci_mcasp *mcasp, int div_id,
>  		break;
>  
>  	default:
> -		return -EINVAL;
> +		ret = -EINVAL;
>  	}
>  
>  	pm_runtime_put(mcasp->dev);
> -	return 0;
> +	return ret;
>  }
>  
>  static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id,
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux