sound/hda/codecs/conexant.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
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;
break;
}
--
2.25.1
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on v7.1-rc1]
[cannot apply to tiwai-sound/for-linus linus/master next-20260430]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wangdich9700-163-com/ALSA-hda-conexant-Fix-missing-error-check-for-jack-detection/20260427-223457
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20260427070739.133369-1-wangdich9700%40163.com
patch subject: [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
config: i386-randconfig-062-20260430 (https://download.01.org/0day-ci/archive/20260501/202605011107.lDwIcnm6-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260501/202605011107.lDwIcnm6-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605011107.lDwIcnm6-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> sound/hda/codecs/conexant.c:1193:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected int err @@ got struct hda_jack_callback * @@
sound/hda/codecs/conexant.c:1193:21: sparse: expected int err
sound/hda/codecs/conexant.c:1193:21: sparse: got struct hda_jack_callback *
vim +1193 sound/hda/codecs/conexant.c
1174
1175 static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
1176 {
1177 struct conexant_spec *spec;
1178 int err;
1179
1180 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1181
1182 spec = kzalloc_obj(*spec);
1183 if (!spec)
1184 return -ENOMEM;
1185 snd_hda_gen_spec_init(&spec->gen);
1186 codec->spec = spec;
1187
1188 /* init cx11880/sn6140 flag and reset headset_present_flag */
1189 switch (codec->core.vendor_id) {
1190 case 0x14f11f86:
1191 case 0x14f11f87:
1192 spec->is_cx11880_sn6140 = true;
> 1193 err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
1194 if (err < 0)
1195 goto error;
1196 break;
1197 }
1198
1199 cx_auto_parse_eapd(codec);
1200 spec->gen.own_eapd_ctl = 1;
1201
1202 switch (codec->core.vendor_id) {
1203 case 0x14f15045:
1204 codec->single_adc_amp = 1;
1205 spec->gen.mixer_nid = 0x17;
1206 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1207 snd_hda_pick_fixup(codec, cxt5045_fixup_models,
1208 cxt5045_fixups, cxt_fixups);
1209 break;
1210 case 0x14f15047:
1211 codec->pin_amp_workaround = 1;
1212 spec->gen.mixer_nid = 0x19;
1213 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1214 snd_hda_pick_fixup(codec, cxt5047_fixup_models,
1215 cxt5047_fixups, cxt_fixups);
1216 break;
1217 case 0x14f15051:
1218 add_cx5051_fake_mutes(codec);
1219 codec->pin_amp_workaround = 1;
1220 snd_hda_pick_fixup(codec, cxt5051_fixup_models,
1221 cxt5051_fixups, cxt_fixups);
1222 break;
1223 case 0x14f15098:
1224 codec->pin_amp_workaround = 1;
1225 spec->gen.mixer_nid = 0x22;
1226 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1227 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1228 cxt5066_fixups, cxt_fixups);
1229 break;
1230 case 0x14f150f2:
1231 codec->power_save_node = 1;
1232 fallthrough;
1233 default:
1234 codec->pin_amp_workaround = 1;
1235 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1236 cxt5066_fixups, cxt_fixups);
1237 break;
1238 }
1239
1240 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
1241 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;
1242
1243 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1244
1245 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1246 spec->parse_flags);
1247 if (err < 0)
1248 goto error;
1249
1250 err = cx_auto_parse_beep(codec);
1251 if (err < 0)
1252 goto error;
1253
1254 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1255 if (err < 0)
1256 goto error;
1257
1258 /* Some laptops with Conexant chips show stalls in S3 resume,
1259 * which falls into the single-cmd mode.
1260 * Better to make reset, then.
1261 */
1262 if (!codec->bus->core.sync_write) {
1263 codec_info(codec,
1264 "Enable sync_write for stable communication\n");
1265 codec->bus->core.sync_write = 1;
1266 codec->bus->allow_bus_reset = 1;
1267 }
1268
1269 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1270
1271 return 0;
1272
1273 error:
1274 cx_remove(codec);
1275 return err;
1276 }
1277
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on linus/master v7.1-rc1]
[cannot apply to tiwai-sound/for-linus next-20260429]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wangdich9700-163-com/ALSA-hda-conexant-Fix-missing-error-check-for-jack-detection/20260427-223457
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20260427070739.133369-1-wangdich9700%40163.com
patch subject: [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
config: i386-randconfig-062-20260430 (https://download.01.org/0day-ci/archive/20260430/202604302001.sGykyKli-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260430/202604302001.sGykyKli-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604302001.sGykyKli-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> sound/hda/codecs/conexant.c:1193:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected int err @@ got struct hda_jack_callback * @@
sound/hda/codecs/conexant.c:1193:21: sparse: expected int err
sound/hda/codecs/conexant.c:1193:21: sparse: got struct hda_jack_callback *
vim +1193 sound/hda/codecs/conexant.c
1174
1175 static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
1176 {
1177 struct conexant_spec *spec;
1178 int err;
1179
1180 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1181
1182 spec = kzalloc_obj(*spec);
1183 if (!spec)
1184 return -ENOMEM;
1185 snd_hda_gen_spec_init(&spec->gen);
1186 codec->spec = spec;
1187
1188 /* init cx11880/sn6140 flag and reset headset_present_flag */
1189 switch (codec->core.vendor_id) {
1190 case 0x14f11f86:
1191 case 0x14f11f87:
1192 spec->is_cx11880_sn6140 = true;
> 1193 err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
1194 if (err < 0)
1195 goto error;
1196 break;
1197 }
1198
1199 cx_auto_parse_eapd(codec);
1200 spec->gen.own_eapd_ctl = 1;
1201
1202 switch (codec->core.vendor_id) {
1203 case 0x14f15045:
1204 codec->single_adc_amp = 1;
1205 spec->gen.mixer_nid = 0x17;
1206 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1207 snd_hda_pick_fixup(codec, cxt5045_fixup_models,
1208 cxt5045_fixups, cxt_fixups);
1209 break;
1210 case 0x14f15047:
1211 codec->pin_amp_workaround = 1;
1212 spec->gen.mixer_nid = 0x19;
1213 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1214 snd_hda_pick_fixup(codec, cxt5047_fixup_models,
1215 cxt5047_fixups, cxt_fixups);
1216 break;
1217 case 0x14f15051:
1218 add_cx5051_fake_mutes(codec);
1219 codec->pin_amp_workaround = 1;
1220 snd_hda_pick_fixup(codec, cxt5051_fixup_models,
1221 cxt5051_fixups, cxt_fixups);
1222 break;
1223 case 0x14f15098:
1224 codec->pin_amp_workaround = 1;
1225 spec->gen.mixer_nid = 0x22;
1226 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1227 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1228 cxt5066_fixups, cxt_fixups);
1229 break;
1230 case 0x14f150f2:
1231 codec->power_save_node = 1;
1232 fallthrough;
1233 default:
1234 codec->pin_amp_workaround = 1;
1235 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1236 cxt5066_fixups, cxt_fixups);
1237 break;
1238 }
1239
1240 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
1241 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;
1242
1243 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1244
1245 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1246 spec->parse_flags);
1247 if (err < 0)
1248 goto error;
1249
1250 err = cx_auto_parse_beep(codec);
1251 if (err < 0)
1252 goto error;
1253
1254 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1255 if (err < 0)
1256 goto error;
1257
1258 /* Some laptops with Conexant chips show stalls in S3 resume,
1259 * which falls into the single-cmd mode.
1260 * Better to make reset, then.
1261 */
1262 if (!codec->bus->core.sync_write) {
1263 codec_info(codec,
1264 "Enable sync_write for stable communication\n");
1265 codec->bus->core.sync_write = 1;
1266 codec->bus->allow_bus_reset = 1;
1267 }
1268
1269 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1270
1271 return 0;
1272
1273 error:
1274 cx_remove(codec);
1275 return err;
1276 }
1277
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on linus/master v7.1-rc1 next-20260428]
[cannot apply to tiwai-sound/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wangdich9700-163-com/ALSA-hda-conexant-Fix-missing-error-check-for-jack-detection/20260427-223457
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20260427070739.133369-1-wangdich9700%40163.com
patch subject: [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20260429/202604291855.b3tkw7T5-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260429/202604291855.b3tkw7T5-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604291855.b3tkw7T5-lkp@intel.com/
All warnings (new ones prefixed by >>):
sound/hda/codecs/conexant.c: In function 'cx_probe':
>> sound/hda/codecs/conexant.c:1193:21: warning: assignment to 'int' from 'struct hda_jack_callback *' makes integer from pointer without a cast [-Wint-conversion]
1193 | err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
| ^
vim +1193 sound/hda/codecs/conexant.c
1174
1175 static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
1176 {
1177 struct conexant_spec *spec;
1178 int err;
1179
1180 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1181
1182 spec = kzalloc_obj(*spec);
1183 if (!spec)
1184 return -ENOMEM;
1185 snd_hda_gen_spec_init(&spec->gen);
1186 codec->spec = spec;
1187
1188 /* init cx11880/sn6140 flag and reset headset_present_flag */
1189 switch (codec->core.vendor_id) {
1190 case 0x14f11f86:
1191 case 0x14f11f87:
1192 spec->is_cx11880_sn6140 = true;
> 1193 err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
1194 if (err < 0)
1195 goto error;
1196 break;
1197 }
1198
1199 cx_auto_parse_eapd(codec);
1200 spec->gen.own_eapd_ctl = 1;
1201
1202 switch (codec->core.vendor_id) {
1203 case 0x14f15045:
1204 codec->single_adc_amp = 1;
1205 spec->gen.mixer_nid = 0x17;
1206 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1207 snd_hda_pick_fixup(codec, cxt5045_fixup_models,
1208 cxt5045_fixups, cxt_fixups);
1209 break;
1210 case 0x14f15047:
1211 codec->pin_amp_workaround = 1;
1212 spec->gen.mixer_nid = 0x19;
1213 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1214 snd_hda_pick_fixup(codec, cxt5047_fixup_models,
1215 cxt5047_fixups, cxt_fixups);
1216 break;
1217 case 0x14f15051:
1218 add_cx5051_fake_mutes(codec);
1219 codec->pin_amp_workaround = 1;
1220 snd_hda_pick_fixup(codec, cxt5051_fixup_models,
1221 cxt5051_fixups, cxt_fixups);
1222 break;
1223 case 0x14f15098:
1224 codec->pin_amp_workaround = 1;
1225 spec->gen.mixer_nid = 0x22;
1226 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1227 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1228 cxt5066_fixups, cxt_fixups);
1229 break;
1230 case 0x14f150f2:
1231 codec->power_save_node = 1;
1232 fallthrough;
1233 default:
1234 codec->pin_amp_workaround = 1;
1235 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1236 cxt5066_fixups, cxt_fixups);
1237 break;
1238 }
1239
1240 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
1241 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;
1242
1243 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1244
1245 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1246 spec->parse_flags);
1247 if (err < 0)
1248 goto error;
1249
1250 err = cx_auto_parse_beep(codec);
1251 if (err < 0)
1252 goto error;
1253
1254 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1255 if (err < 0)
1256 goto error;
1257
1258 /* Some laptops with Conexant chips show stalls in S3 resume,
1259 * which falls into the single-cmd mode.
1260 * Better to make reset, then.
1261 */
1262 if (!codec->bus->core.sync_write) {
1263 codec_info(codec,
1264 "Enable sync_write for stable communication\n");
1265 codec->bus->core.sync_write = 1;
1266 codec->bus->allow_bus_reset = 1;
1267 }
1268
1269 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1270
1271 return 0;
1272
1273 error:
1274 cx_remove(codec);
1275 return err;
1276 }
1277
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus linus/master v7.1-rc1 next-20260428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wangdich9700-163-com/ALSA-hda-conexant-Fix-missing-error-check-for-jack-detection/20260427-223457
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20260427070739.133369-1-wangdich9700%40163.com
patch subject: [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260429/202604290635.UqkW5dEd-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260429/202604290635.UqkW5dEd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604290635.UqkW5dEd-lkp@intel.com/
All errors (new ones prefixed by >>):
>> sound/hda/codecs/conexant.c:1193:7: error: incompatible pointer to integer conversion assigning to 'int' from 'struct hda_jack_callback *' [-Wint-conversion]
1193 | err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
vim +1193 sound/hda/codecs/conexant.c
1174
1175 static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
1176 {
1177 struct conexant_spec *spec;
1178 int err;
1179
1180 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1181
1182 spec = kzalloc_obj(*spec);
1183 if (!spec)
1184 return -ENOMEM;
1185 snd_hda_gen_spec_init(&spec->gen);
1186 codec->spec = spec;
1187
1188 /* init cx11880/sn6140 flag and reset headset_present_flag */
1189 switch (codec->core.vendor_id) {
1190 case 0x14f11f86:
1191 case 0x14f11f87:
1192 spec->is_cx11880_sn6140 = true;
> 1193 err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
1194 if (err < 0)
1195 goto error;
1196 break;
1197 }
1198
1199 cx_auto_parse_eapd(codec);
1200 spec->gen.own_eapd_ctl = 1;
1201
1202 switch (codec->core.vendor_id) {
1203 case 0x14f15045:
1204 codec->single_adc_amp = 1;
1205 spec->gen.mixer_nid = 0x17;
1206 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1207 snd_hda_pick_fixup(codec, cxt5045_fixup_models,
1208 cxt5045_fixups, cxt_fixups);
1209 break;
1210 case 0x14f15047:
1211 codec->pin_amp_workaround = 1;
1212 spec->gen.mixer_nid = 0x19;
1213 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1214 snd_hda_pick_fixup(codec, cxt5047_fixup_models,
1215 cxt5047_fixups, cxt_fixups);
1216 break;
1217 case 0x14f15051:
1218 add_cx5051_fake_mutes(codec);
1219 codec->pin_amp_workaround = 1;
1220 snd_hda_pick_fixup(codec, cxt5051_fixup_models,
1221 cxt5051_fixups, cxt_fixups);
1222 break;
1223 case 0x14f15098:
1224 codec->pin_amp_workaround = 1;
1225 spec->gen.mixer_nid = 0x22;
1226 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1227 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1228 cxt5066_fixups, cxt_fixups);
1229 break;
1230 case 0x14f150f2:
1231 codec->power_save_node = 1;
1232 fallthrough;
1233 default:
1234 codec->pin_amp_workaround = 1;
1235 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1236 cxt5066_fixups, cxt_fixups);
1237 break;
1238 }
1239
1240 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
1241 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;
1242
1243 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1244
1245 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1246 spec->parse_flags);
1247 if (err < 0)
1248 goto error;
1249
1250 err = cx_auto_parse_beep(codec);
1251 if (err < 0)
1252 goto error;
1253
1254 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1255 if (err < 0)
1256 goto error;
1257
1258 /* Some laptops with Conexant chips show stalls in S3 resume,
1259 * which falls into the single-cmd mode.
1260 * Better to make reset, then.
1261 */
1262 if (!codec->bus->core.sync_write) {
1263 codec_info(codec,
1264 "Enable sync_write for stable communication\n");
1265 codec->bus->core.sync_write = 1;
1266 codec->bus->allow_bus_reset = 1;
1267 }
1268
1269 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1270
1271 return 0;
1272
1273 error:
1274 cx_remove(codec);
1275 return err;
1276 }
1277
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus linus/master v7.1-rc1 next-20260428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wangdich9700-163-com/ALSA-hda-conexant-Fix-missing-error-check-for-jack-detection/20260427-223457
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20260427070739.133369-1-wangdich9700%40163.com
patch subject: [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20260429/202604290213.cQAWGYOO-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260429/202604290213.cQAWGYOO-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604290213.cQAWGYOO-lkp@intel.com/
All errors (new ones prefixed by >>):
sound/hda/codecs/conexant.c: In function 'cx_probe':
>> sound/hda/codecs/conexant.c:1193:21: error: assignment to 'int' from 'struct hda_jack_callback *' makes integer from pointer without a cast [-Wint-conversion]
1193 | err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
| ^
vim +1193 sound/hda/codecs/conexant.c
1174
1175 static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
1176 {
1177 struct conexant_spec *spec;
1178 int err;
1179
1180 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1181
1182 spec = kzalloc_obj(*spec);
1183 if (!spec)
1184 return -ENOMEM;
1185 snd_hda_gen_spec_init(&spec->gen);
1186 codec->spec = spec;
1187
1188 /* init cx11880/sn6140 flag and reset headset_present_flag */
1189 switch (codec->core.vendor_id) {
1190 case 0x14f11f86:
1191 case 0x14f11f87:
1192 spec->is_cx11880_sn6140 = true;
> 1193 err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
1194 if (err < 0)
1195 goto error;
1196 break;
1197 }
1198
1199 cx_auto_parse_eapd(codec);
1200 spec->gen.own_eapd_ctl = 1;
1201
1202 switch (codec->core.vendor_id) {
1203 case 0x14f15045:
1204 codec->single_adc_amp = 1;
1205 spec->gen.mixer_nid = 0x17;
1206 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1207 snd_hda_pick_fixup(codec, cxt5045_fixup_models,
1208 cxt5045_fixups, cxt_fixups);
1209 break;
1210 case 0x14f15047:
1211 codec->pin_amp_workaround = 1;
1212 spec->gen.mixer_nid = 0x19;
1213 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1214 snd_hda_pick_fixup(codec, cxt5047_fixup_models,
1215 cxt5047_fixups, cxt_fixups);
1216 break;
1217 case 0x14f15051:
1218 add_cx5051_fake_mutes(codec);
1219 codec->pin_amp_workaround = 1;
1220 snd_hda_pick_fixup(codec, cxt5051_fixup_models,
1221 cxt5051_fixups, cxt_fixups);
1222 break;
1223 case 0x14f15098:
1224 codec->pin_amp_workaround = 1;
1225 spec->gen.mixer_nid = 0x22;
1226 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1227 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1228 cxt5066_fixups, cxt_fixups);
1229 break;
1230 case 0x14f150f2:
1231 codec->power_save_node = 1;
1232 fallthrough;
1233 default:
1234 codec->pin_amp_workaround = 1;
1235 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1236 cxt5066_fixups, cxt_fixups);
1237 break;
1238 }
1239
1240 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
1241 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;
1242
1243 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1244
1245 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1246 spec->parse_flags);
1247 if (err < 0)
1248 goto error;
1249
1250 err = cx_auto_parse_beep(codec);
1251 if (err < 0)
1252 goto error;
1253
1254 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1255 if (err < 0)
1256 goto error;
1257
1258 /* Some laptops with Conexant chips show stalls in S3 resume,
1259 * which falls into the single-cmd mode.
1260 * Better to make reset, then.
1261 */
1262 if (!codec->bus->core.sync_write) {
1263 codec_info(codec,
1264 "Enable sync_write for stable communication\n");
1265 codec->bus->core.sync_write = 1;
1266 codec->bus->allow_bus_reset = 1;
1267 }
1268
1269 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1270
1271 return 0;
1272
1273 error:
1274 cx_remove(codec);
1275 return err;
1276 }
1277
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
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
… > Check the return value and propagate the error to the probe caller. See also: * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.0#n145 * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.0#n34 Regards, Markus
© 2016 - 2026 Red Hat, Inc.