[alsa-devel] ASoC: wm8962: Move register initialisation to I2C probe()

Dan Carpenter dan.carpenter at oracle.com
Fri Nov 1 11:33:48 CET 2013


Hello Mark Brown,

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

The patch 78b78f5c019e: "ASoC: wm8962: Move register initialisation 
to I2C probe()" from Oct 17, 2013, leads to the following Smatch 
complaint:

sound/soc/codecs/wm8962.c:3620 wm8962_i2c_probe()
	 error: we previously assumed 'pdata' could be null (see line 3537)

sound/soc/codecs/wm8962.c
  3531          /* If platform data was supplied, update the default data in priv */
  3532          if (pdata) {
                    ^^^^^
Existing check.

  3533                  memcpy(&wm8962->pdata, pdata, sizeof(struct wm8962_pdata));
  3534          } else if (i2c->dev.of_node) {
  3535                  ret = wm8962_set_pdata_from_of(i2c, &wm8962->pdata);
  3536			if (ret != 0)
  3537				return ret;
  3538		}

[snip]

  3613		/* Ensure that the oscillator and PLLs are disabled */
  3614		regmap_update_bits(wm8962->regmap, WM8962_PLL2,
  3615				   WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA,
  3616				   0);
  3617	
  3618		/* Apply static configuration for GPIOs */
  3619		for (i = 0; i < ARRAY_SIZE(pdata->gpio_init); i++)
  3620			if (pdata->gpio_init[i]) {
                            ^^^^^^^^^^^^^^^^^^
Patch introduces unchecked dereference.

  3621				wm8962_set_gpio_mode(wm8962, i + 1);
  3622				regmap_write(wm8962->regmap, 0x200 + i,

regards,
dan carpenter


More information about the Alsa-devel mailing list