struct wm8510_priv *wm8510;
int ret;
- wm8510 = kzalloc(sizeof(struct wm8510_priv), GFP_KERNEL);
+ wm8510 = devm_kzalloc(&spi->dev, sizeof(struct wm8510_priv),
+ GFP_KERNEL);
if (wm8510 == NULL)
return -ENOMEM;
ret = snd_soc_register_codec(&spi->dev,
&soc_codec_dev_wm8510, &wm8510_dai, 1);
- if (ret < 0)
- kfree(wm8510);
+
return ret;
}
struct wm8510_priv *wm8510;
int ret;
- wm8510 = kzalloc(sizeof(struct wm8510_priv), GFP_KERNEL);
+ wm8510 = devm_kzalloc(&i2c->dev, sizeof(struct wm8510_priv),
+ GFP_KERNEL);
if (wm8510 == NULL)
return -ENOMEM;
ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8510, &wm8510_dai, 1);
- if (ret < 0)
- kfree(wm8510);
+
return ret;
}