--- initial
+++ final
@@ -1,82 +1,81 @@
 static int wm2000_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i2c_id) {
   struct wm2000_priv *wm2000;
   struct wm2000_platform_data *pdata;
   const char *filename;
   const struct firmware *fw = NULL;
   int ret, i;
   int reg;
   u16 id;
   wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), GFP_KERNEL);
   if (!wm2000) return -ENOMEM;
   mutex_init(&wm2000->lock);
   dev_set_drvdata(&i2c->dev, wm2000);
   wm2000->regmap = devm_regmap_init_i2c(i2c, &wm2000_regmap);
   if (IS_ERR(wm2000->regmap)) {
     ret = PTR_ERR(wm2000->regmap);
     dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret);
     goto out;
   }
   for (i = 0; i < WM2000_NUM_SUPPLIES; i++)
     wm2000->supplies[i].supply = wm2000_supplies[i];
   ret = devm_regulator_bulk_get(&i2c->dev, WM2000_NUM_SUPPLIES, wm2000->supplies);
   if (ret != 0) {
     dev_err(&i2c->dev, "Failed to get supplies: %d\n", ret);
     return ret;
   }
   ret = regulator_bulk_enable(WM2000_NUM_SUPPLIES, wm2000->supplies);
   if (ret != 0) {
     dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
     return ret;
   }
   /* Verify that this is a WM2000 */
   reg = wm2000_read(i2c, WM2000_REG_ID1);
   id = reg << 8;
   reg = wm2000_read(i2c, WM2000_REG_ID2);
   id |= reg & 0xff;
   if (id != 0x2000) {
     dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id);
     ret = -ENODEV;
     goto err_supplies;
   }
   reg = wm2000_read(i2c, WM2000_REG_REVISON);
   dev_info(&i2c->dev, "revision %c\n", reg + 'A');
   wm2000->mclk = devm_clk_get(&i2c->dev, "MCLK");
   if (IS_ERR(wm2000->mclk)) {
     ret = PTR_ERR(wm2000->mclk);
     dev_err(&i2c->dev, "Failed to get MCLK: %d\n", ret);
     goto err_supplies;
   }
   filename = "wm2000_anc.bin";
   pdata = dev_get_platdata(&i2c->dev);
   if (pdata) {
     wm2000->speech_clarity = !pdata->speech_enh_disable;
     if (pdata->download_file) filename = pdata->download_file;
   }
   ret = request_firmware(&fw, filename, &i2c->dev);
   if (ret != 0) {
     dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret);
     goto err_supplies;
   }
   /* Pre-cook the concatenation of the register address onto the image */
   wm2000->anc_download_size = fw->size + 2;
   wm2000->anc_download = devm_kzalloc(&i2c->dev, wm2000->anc_download_size, GFP_KERNEL);
   if (wm2000->anc_download == NULL) {
-    dev_err(&i2c->dev, "Out of memory\n");
     ret = -ENOMEM;
     goto err_supplies;
   }
   wm2000->anc_download[0] = 0x80;
   wm2000->anc_download[1] = 0x00;
   memcpy(wm2000->anc_download + 2, fw->data, fw->size);
   wm2000->anc_eng_ena = 1;
   wm2000->anc_active = 1;
   wm2000->spk_ena = 1;
   wm2000->i2c = i2c;
   wm2000_reset(wm2000);
   ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0);
 err_supplies:
   regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies);
 out:
   release_firmware(fw);
   return ret;
 }<sep>@@
expression x;
identifier f;
constant char[] c;
statement S;
@@

x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
	\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
	\|rhashtable_lookup_fast\)
      (...);
if (x == NULL) {
  ...
- f(...,c,...);
  ...
} else S