--- initial
+++ final
@@ -1,78 +1,75 @@
 static int cs42l56_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) {
   struct cs42l56_private *cs42l56;
   struct cs42l56_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
   int ret, i;
   unsigned int devid = 0;
   unsigned int alpha_rev, metal_rev;
   unsigned int reg;
   cs42l56 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l56_private), GFP_KERNEL);
   if (cs42l56 == NULL) return -ENOMEM;
   cs42l56->dev = &i2c_client->dev;
   cs42l56->regmap = devm_regmap_init_i2c(i2c_client, &cs42l56_regmap);
   if (IS_ERR(cs42l56->regmap)) {
     ret = PTR_ERR(cs42l56->regmap);
     dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
     return ret;
   }
   if (pdata) {
     cs42l56->pdata = *pdata;
   } else {
     pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l56_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) {
       ret = cs42l56_handle_of_data(i2c_client, &cs42l56->pdata);
       if (ret != 0) return ret;
     }
     cs42l56->pdata = *pdata;
   }
   if (cs42l56->pdata.gpio_nreset) {
     ret = gpio_request_one(cs42l56->pdata.gpio_nreset, GPIOF_OUT_INIT_HIGH, "CS42L56 /RST");
     if (ret < 0) {
       dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", cs42l56->pdata.gpio_nreset, ret);
       return ret;
     }
     gpio_set_value_cansleep(cs42l56->pdata.gpio_nreset, 0);
     gpio_set_value_cansleep(cs42l56->pdata.gpio_nreset, 1);
   }
   i2c_set_clientdata(i2c_client, cs42l56);
   for (i = 0; i < ARRAY_SIZE(cs42l56->supplies); i++)
     cs42l56->supplies[i].supply = cs42l56_supply_names[i];
   ret = devm_regulator_bulk_get(&i2c_client->dev, ARRAY_SIZE(cs42l56->supplies), cs42l56->supplies);
   if (ret != 0) {
     dev_err(&i2c_client->dev, "Failed to request supplies: %d\n", ret);
     return ret;
   }
   ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies), cs42l56->supplies);
   if (ret != 0) {
     dev_err(&i2c_client->dev, "Failed to enable supplies: %d\n", ret);
     return ret;
   }
   ret = regmap_read(cs42l56->regmap, CS42L56_CHIP_ID_1, &reg);
   devid = reg & CS42L56_CHIP_ID_MASK;
   if (devid != CS42L56_DEVID) {
     dev_err(&i2c_client->dev, "CS42L56 Device ID (%X). Expected %X\n", devid, CS42L56_DEVID);
     goto err_enable;
   }
   alpha_rev = reg & CS42L56_AREV_MASK;
   metal_rev = reg & CS42L56_MTLREV_MASK;
   dev_info(&i2c_client->dev, "Cirrus Logic CS42L56 ");
   dev_info(&i2c_client->dev, "Alpha Rev %X Metal Rev %X\n", alpha_rev, metal_rev);
   if (cs42l56->pdata.ain1a_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN1A_REF_MASK, CS42L56_AIN1A_REF_MASK);
   if (cs42l56->pdata.ain1b_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN1B_REF_MASK, CS42L56_AIN1B_REF_MASK);
   if (cs42l56->pdata.ain2a_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN2A_REF_MASK, CS42L56_AIN2A_REF_MASK);
   if (cs42l56->pdata.ain2b_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN2B_REF_MASK, CS42L56_AIN2B_REF_MASK);
   if (cs42l56->pdata.micbias_lvl) regmap_update_bits(cs42l56->regmap, CS42L56_GAIN_BIAS_CTL, CS42L56_MIC_BIAS_MASK, cs42l56->pdata.micbias_lvl);
   if (cs42l56->pdata.chgfreq) regmap_update_bits(cs42l56->regmap, CS42L56_CLASSH_CTL, CS42L56_CHRG_FREQ_MASK, cs42l56->pdata.chgfreq);
   if (cs42l56->pdata.hpfb_freq) regmap_update_bits(cs42l56->regmap, CS42L56_HPF_CTL, CS42L56_HPFB_FREQ_MASK, cs42l56->pdata.hpfb_freq);
   if (cs42l56->pdata.hpfa_freq) regmap_update_bits(cs42l56->regmap, CS42L56_HPF_CTL, CS42L56_HPFA_FREQ_MASK, cs42l56->pdata.hpfa_freq);
   if (cs42l56->pdata.adaptive_pwr) regmap_update_bits(cs42l56->regmap, CS42L56_CLASSH_CTL, CS42L56_ADAPT_PWR_MASK, cs42l56->pdata.adaptive_pwr);
   ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_cs42l56, &cs42l56_dai, 1);
   if (ret < 0) return ret;
   return 0;
 err_enable:
   regulator_bulk_disable(ARRAY_SIZE(cs42l56->supplies), cs42l56->supplies);
   return ret;
 }<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