--- initial
+++ final
@@ -1,62 +1,59 @@
 static int cs42l52_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) {
   struct cs42l52_private *cs42l52;
   struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
   int ret;
   unsigned int devid = 0;
   unsigned int reg;
   u32 val32;
   cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l52_private), GFP_KERNEL);
   if (cs42l52 == NULL) return -ENOMEM;
   cs42l52->dev = &i2c_client->dev;
   cs42l52->regmap = devm_regmap_init_i2c(i2c_client, &cs42l52_regmap);
   if (IS_ERR(cs42l52->regmap)) {
     ret = PTR_ERR(cs42l52->regmap);
     dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
     return ret;
   }
   if (pdata) {
     cs42l52->pdata = *pdata;
   } else {
     pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l52_platform_data), GFP_KERNEL);
-    if (!pdata) {
-      dev_err(&i2c_client->dev, "could not allocate pdata\n");
-      return -ENOMEM;
-    }
+    if (!pdata) return -ENOMEM;
     if (i2c_client->dev.of_node) {
       if (of_property_read_bool(i2c_client->dev.of_node, "cirrus,mica-differential-cfg")) pdata->mica_diff_cfg = true;
       if (of_property_read_bool(i2c_client->dev.of_node, "cirrus,micb-differential-cfg")) pdata->micb_diff_cfg = true;
       if (of_property_read_u32(i2c_client->dev.of_node, "cirrus,micbias-lvl", &val32) >= 0) pdata->micbias_lvl = val32;
       if (of_property_read_u32(i2c_client->dev.of_node, "cirrus,chgfreq-divisor", &val32) >= 0) pdata->chgfreq = val32;
       pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, "cirrus,reset-gpio", 0);
     }
     cs42l52->pdata = *pdata;
   }
   if (cs42l52->pdata.reset_gpio) {
     ret = devm_gpio_request_one(&i2c_client->dev, cs42l52->pdata.reset_gpio, GPIOF_OUT_INIT_HIGH, "CS42L52 /RST");
     if (ret < 0) {
       dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", cs42l52->pdata.reset_gpio, ret);
       return ret;
     }
     gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 0);
     gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 1);
   }
   i2c_set_clientdata(i2c_client, cs42l52);
   ret = regmap_register_patch(cs42l52->regmap, cs42l52_threshold_patch, ARRAY_SIZE(cs42l52_threshold_patch));
   if (ret != 0) dev_warn(cs42l52->dev, "Failed to apply regmap patch: %d\n", ret);
   ret = regmap_read(cs42l52->regmap, CS42L52_CHIP, &reg);
   devid = reg & CS42L52_CHIP_ID_MASK;
   if (devid != CS42L52_CHIP_ID) {
     ret = -ENODEV;
     dev_err(&i2c_client->dev, "CS42L52 Device ID (%X). Expected %X\n", devid, CS42L52_CHIP_ID);
     return ret;
   }
   dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n", reg & CS42L52_CHIP_REV_MASK);
   /* Set Platform Data */
   if (cs42l52->pdata.mica_diff_cfg) regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL, CS42L52_MIC_CTL_TYPE_MASK, cs42l52->pdata.mica_diff_cfg << CS42L52_MIC_CTL_TYPE_SHIFT);
   if (cs42l52->pdata.micb_diff_cfg) regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL, CS42L52_MIC_CTL_TYPE_MASK, cs42l52->pdata.micb_diff_cfg << CS42L52_MIC_CTL_TYPE_SHIFT);
   if (cs42l52->pdata.chgfreq) regmap_update_bits(cs42l52->regmap, CS42L52_CHARGE_PUMP, CS42L52_CHARGE_PUMP_MASK, cs42l52->pdata.chgfreq << CS42L52_CHARGE_PUMP_SHIFT);
   if (cs42l52->pdata.micbias_lvl) regmap_update_bits(cs42l52->regmap, CS42L52_IFACE_CTL2, CS42L52_IFACE_CTL2_BIAS_LVL, cs42l52->pdata.micbias_lvl);
   ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_cs42l52, &cs42l52_dai, 1);
   if (ret < 0) return ret;
   return 0;
 }<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@

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,...);
  S1
- }
 else S2