[alsa-devel] [PATCH][RFC] ASoC: soc-pcm: fixup module_put() calling timing

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Sat May 18 19:53:02 CEST 2019


On Fri, 2019-05-17 at 17:16 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> 
> soc_pcm_components_close() try to call module_put()
> based on component->driver->module_get_upon_open.
> But, it should be called even though it doesn't have .close callback.
I think this makes sense. Thanks!

Ranjani
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
> Mark, Pierre-Louis, Vinod, Liam
> 
> I think this patch is correct, but I'm not sure.
> I'm happy if someone can confirm it.
> 
>  sound/soc/soc-pcm.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 7b4cda6..e24eab3 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -477,11 +477,9 @@ static int soc_pcm_components_close(struct
> snd_pcm_substream *substream,
>  		if (component == last)
>  			break;
>  
> -		if (!component->driver->ops ||
> -		    !component->driver->ops->close)
> -			continue;
> -
> -		component->driver->ops->close(substream);
> +		if (component->driver->ops &&
> +		    component->driver->ops->close)
> +			component->driver->ops->close(substream);
>  
>  		if (component->driver->module_get_upon_open)
>  			module_put(component->dev->driver->owner);



More information about the Alsa-devel mailing list