Re: [PATCH] ASoC: SOF: Intel: hda-codec: fix double put_device() on registration error
From: Kai Vehmanen
Date: Fri Dec 04 2026 - 05:34:51 EST
Hey,
On Fri, 4 Dec 2026, Yuansheng Yang wrote:
> When probing an HD-audio codec, hda_codec_probe() allocates the codec
> via hda_codec_device_init() -> snd_hda_codec_device_init() ->
> snd_hdac_device_init(), which initializes the embedded device reference
> count (kref == 1) and inserts the codec into bus->codec_list and
> bus->caddr_tbl[] without taking an additional device reference.
[..]
> --- a/sound/soc/sof/intel/hda-codec.c
> +++ b/sound/soc/sof/intel/hda-codec.c
> @@ -57,7 +57,6 @@ static int hda_codec_load_module(struct hda_codec *codec)
> ret = snd_hdac_device_register(&codec->core);
> if (ret) {
> dev_err(&codec->core.dev, "failed to register hdac device\n");
> - put_device(&codec->core.dev);
> return ret;
> }
the commit is very verbose, but analysis and fix are correct, so:
Reviewed-by: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx>
Br, Kai