Skip to contentSkip to conversation

ASoC: codec: wcd938x: Add switch control for selecting CTIA/OMTP Headset

bug report Dan Carpenter 1 participant 1 message Feb 18, 2022

lore
Share & tools
lore
#0 lore raw

Hello Srinivasa Rao Mandadapu,

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

The patch 013cc2aea0f6: "ASoC: codec: wcd938x: Add switch control for selecting CTIA/OMTP Headset" from Feb 12, 2022, leads to the following Smatch complaint:

sound/soc/codecs/wcd938x.c:4210 wcd938x_swap_gnd_mic()
error: we previously assumed 'component' could be null (see line 4209)

sound/soc/codecs/wcd938x.c
4203 static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool active)
4204 {
4205 int value;
4206
4207 struct wcd938x_priv *wcd938x;
4208

  4209                if (!component) {
                           ^^^^^^^^^

Check for NULL.

  4210                        dev_err(component->dev, "%s component is NULL\n", __func__);
                                      ^^^^^^^^^^^^^^

NULL Dereference. But can it really be NULL?

4211 return false;
4212 }
4213

regards,
dan carpenter