Skip to contentSkip to conversation

ASoC: cx20442: replace codec to component

bug report Dan Carpenter 2 participants 2 messages Oct 26, 2023

lore
Share & tools
lore
#0 lore raw

[ I don't know why I am seeing warnings from 2018 today. Also this
patch didn't really introduce the bug, it's just the variables were renamed. -dan ]

Hello Kuninori Morimoto,

This is a semi-automatic email about new static checker warnings.

The patch d0fdfe34080c: "ASoC: cx20442: replace codec to component" from Jan 29, 2018, leads to the following Smatch complaint:

sound/soc/ti/ams-delta.c:311 cx81801_close()
warn: variable dereferenced before check 'component' (see line 304)

sound/soc/ti/ams-delta.c
303 struct snd_soc_component *component = tty->disc_data;

   304		struct snd_soc_dapm_context *dapm = &component->card->dapm;
                                                    ^^^^^^^^^^^^^^^^^^

Dereference.

305
306 del_timer_sync(&cx81801_timer);
307
308 /* Prevent the hook switch from further changing the DAPM pins */
309 INIT_LIST_HEAD(&ams_delta_hook_switch.pins);
310
311 if (!component)

                    ^^^^^^^^^^

Check for NULL is too late.

312 return;
313

regards,
dan carpenter

#1 lore raw

Hi Dan

Quoted 3 lines

[ I don't know why I am seeing warnings from 2018 today. Also this
patch didn't really introduce the bug, it's just the variables were renamed. -dan ]

Interesting...

Quoted 7 lines

This is a semi-automatic email about new static checker warnings.

The patch d0fdfe34080c: "ASoC: cx20442: replace codec to component" from Jan 29, 2018, leads to the following Smatch complaint:

sound/soc/ti/ams-delta.c:311 cx81801_close()
warn: variable dereferenced before check 'component' (see line 304)

Thank you for your report.
I will try to fix it tomorrow.

Thank you for your help !!

Best regards
---
Kuninori Morimoto