[bug report] ASoC: codec: wcd938x: Add switch control for selecting CTIA/OMTP Headset

Dan Carpenter dan.carpenter at oracle.com
Fri Feb 18 16:34:25 CET 2022


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


More information about the Alsa-devel mailing list