From: Takashi Iwai <tiwai@suse.de>
To: wangdich9700@163.com
Cc: perex@perex.cz, tiwai@suse.com, kees@kernel.org,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
wangdicheng <wangdicheng@kylinos.cn>
Subject: Re: [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
Date: Mon, 27 Apr 2026 14:41:24 +0200 [thread overview]
Message-ID: <874ikwzibv.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260427070739.133369-1-wangdich9700@163.com>
On Mon, 27 Apr 2026 09:07:39 +0200,
wangdich9700@163.com wrote:
>
> From: wangdicheng <wangdicheng@kylinos.cn>
>
> In cx_probe(), the return value of snd_hda_jack_detect_enable_callback()
> is ignored. If this function fails (e.g., due to memory allocation
> failure), the driver continues to probe, but the jack detection callback
> will not be registered. This can lead to a kernel crash later when the
> driver attempts to handle jack events or accesses the uninitialized
> structure.
>
> Check the return value and propagate the error to the probe caller.
>
> Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
> ---
> sound/hda/codecs/conexant.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
> index 3a9717df39b4..4c01c6270bd3 100644
> --- a/sound/hda/codecs/conexant.c
> +++ b/sound/hda/codecs/conexant.c
> @@ -1190,7 +1190,9 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> case 0x14f11f86:
> case 0x14f11f87:
> spec->is_cx11880_sn6140 = true;
> - snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
> + err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
> + if (err < 0)
> + goto error;
The function returns a pointer. Use IS_ERR() and PTR_ERR() to check
and get the error, instead.
Also, don't forget to put Fixes tag.
thanks,
Takashi
next prev parent reply other threads:[~2026-04-27 12:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 7:07 [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection wangdich9700
2026-04-27 11:35 ` Markus Elfring
2026-04-27 12:41 ` Takashi Iwai [this message]
2026-04-28 18:37 ` kernel test robot
2026-04-28 22:38 ` kernel test robot
2026-04-29 11:03 ` kernel test robot
2026-04-30 12:23 ` kernel test robot
2026-05-01 4:05 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874ikwzibv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=wangdich9700@163.com \
--cc=wangdicheng@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox