[alsa-devel] [PATCH] ASoc: hdmi-codec: remove HDMI device unregister

Lars-Peter Clausen lars at metafoo.de
Fri Feb 3 15:29:37 CET 2017


On 02/03/2017 11:10 AM, Vincent Abriou wrote:
> While unregistering the hdmi-codec, the hdmi device list must be
> cleaned up. It avoids kernel page fault when registering again the
> hdmi-codec.
> 
> Cc: Liam Girdwood <lgirdwood at gmail.com>
> Cc: Mark Brown <broonie at kernel.org>
> Cc: Jaroslav Kysela <perex at perex.cz>
> Cc: Takashi Iwai <tiwai at suse.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> Cc: Jyri Sarha <jsarha at ti.com>
> Cc: Arnaud Pouliquen <arnaud.pouliquen at st.com>
> Cc: Philipp Zabel <p.zabel at pengutronix.de>
> 
> Signed-off-by: Vincent Abriou <vincent.abriou at st.com>
> ---
>  sound/soc/codecs/hdmi-codec.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
> index 90b5948..1ca405e 100644
> --- a/sound/soc/codecs/hdmi-codec.c
> +++ b/sound/soc/codecs/hdmi-codec.c
> @@ -479,6 +479,18 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>  
>  static int hdmi_codec_remove(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
> +	struct list_head *pos;
> +
> +	list_for_each(pos, &hdmi_device_list) {

This needs some kind of lock to protect against concurrent iteration and
modification.

> +		struct hdmi_device *tmp = pos_to_hdmi_device(pos);
> +
> +		if (tmp->dev == dev->parent) {
> +			list_del(pos);
> +			break;
> +		}
> +	}
> +
>  	snd_soc_unregister_codec(&pdev->dev);
>  	return 0;
>  }
> 



More information about the Alsa-devel mailing list