aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9713.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm9713.c')
-rw-r--r--sound/soc/codecs/wm9713.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index ba8c276b9dcf..27047839172d 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1191,17 +1191,11 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec)
1191 1191
1192static int wm9713_soc_probe(struct snd_soc_codec *codec) 1192static int wm9713_soc_probe(struct snd_soc_codec *codec)
1193{ 1193{
1194 struct wm9713_priv *wm9713;
1195 int ret = 0, reg; 1194 int ret = 0, reg;
1196 1195
1197 wm9713 = kzalloc(sizeof(struct wm9713_priv), GFP_KERNEL);
1198 if (wm9713 == NULL)
1199 return -ENOMEM;
1200 snd_soc_codec_set_drvdata(codec, wm9713);
1201
1202 ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); 1196 ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0);
1203 if (ret < 0) 1197 if (ret < 0)
1204 goto codec_err; 1198 return ret;
1205 1199
1206 /* do a cold reset for the controller and then try 1200 /* do a cold reset for the controller and then try
1207 * a warm reset followed by an optional cold reset for codec */ 1201 * a warm reset followed by an optional cold reset for codec */
@@ -1220,16 +1214,12 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
1220 1214
1221reset_err: 1215reset_err:
1222 snd_soc_free_ac97_codec(codec); 1216 snd_soc_free_ac97_codec(codec);
1223codec_err:
1224 kfree(wm9713);
1225 return ret; 1217 return ret;
1226} 1218}
1227 1219
1228static int wm9713_soc_remove(struct snd_soc_codec *codec) 1220static int wm9713_soc_remove(struct snd_soc_codec *codec)
1229{ 1221{
1230 struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
1231 snd_soc_free_ac97_codec(codec); 1222 snd_soc_free_ac97_codec(codec);
1232 kfree(wm9713);
1233 return 0; 1223 return 0;
1234} 1224}
1235 1225
@@ -1256,6 +1246,14 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9713 = {
1256 1246
1257static int wm9713_probe(struct platform_device *pdev) 1247static int wm9713_probe(struct platform_device *pdev)
1258{ 1248{
1249 struct wm9713_priv *wm9713;
1250
1251 wm9713 = devm_kzalloc(&pdev->dev, sizeof(*wm9713), GFP_KERNEL);
1252 if (wm9713 == NULL)
1253 return -ENOMEM;
1254
1255 platform_set_drvdata(pdev, wm9713);
1256
1259 return snd_soc_register_codec(&pdev->dev, 1257 return snd_soc_register_codec(&pdev->dev,
1260 &soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai)); 1258 &soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai));
1261} 1259}