diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-21 10:23:26 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-21 16:15:40 -0500 |
commit | a1fea9404f6b400dcbda952599649e6d37aad1c0 (patch) | |
tree | 7c1814eca297bd42bc3a5605aefb44e9907f607c /sound/soc/codecs/wm8985.c | |
parent | 78adaeb2ae7d5e9e1a6e93e06db26d07fdd829fb (diff) |
ASoC: wm8985: Convert to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8985.c')
-rw-r--r-- | sound/soc/codecs/wm8985.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index c0c86b3c6adf..e62a4c55a9c3 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c | |||
@@ -1079,7 +1079,7 @@ static int __devinit wm8985_spi_probe(struct spi_device *spi) | |||
1079 | struct wm8985_priv *wm8985; | 1079 | struct wm8985_priv *wm8985; |
1080 | int ret; | 1080 | int ret; |
1081 | 1081 | ||
1082 | wm8985 = kzalloc(sizeof *wm8985, GFP_KERNEL); | 1082 | wm8985 = devm_kzalloc(&spi->dev, sizeof *wm8985, GFP_KERNEL); |
1083 | if (!wm8985) | 1083 | if (!wm8985) |
1084 | return -ENOMEM; | 1084 | return -ENOMEM; |
1085 | 1085 | ||
@@ -1088,15 +1088,12 @@ static int __devinit wm8985_spi_probe(struct spi_device *spi) | |||
1088 | 1088 | ||
1089 | ret = snd_soc_register_codec(&spi->dev, | 1089 | ret = snd_soc_register_codec(&spi->dev, |
1090 | &soc_codec_dev_wm8985, &wm8985_dai, 1); | 1090 | &soc_codec_dev_wm8985, &wm8985_dai, 1); |
1091 | if (ret < 0) | ||
1092 | kfree(wm8985); | ||
1093 | return ret; | 1091 | return ret; |
1094 | } | 1092 | } |
1095 | 1093 | ||
1096 | static int __devexit wm8985_spi_remove(struct spi_device *spi) | 1094 | static int __devexit wm8985_spi_remove(struct spi_device *spi) |
1097 | { | 1095 | { |
1098 | snd_soc_unregister_codec(&spi->dev); | 1096 | snd_soc_unregister_codec(&spi->dev); |
1099 | kfree(spi_get_drvdata(spi)); | ||
1100 | return 0; | 1097 | return 0; |
1101 | } | 1098 | } |
1102 | 1099 | ||
@@ -1117,7 +1114,7 @@ static __devinit int wm8985_i2c_probe(struct i2c_client *i2c, | |||
1117 | struct wm8985_priv *wm8985; | 1114 | struct wm8985_priv *wm8985; |
1118 | int ret; | 1115 | int ret; |
1119 | 1116 | ||
1120 | wm8985 = kzalloc(sizeof *wm8985, GFP_KERNEL); | 1117 | wm8985 = devm_kzalloc(&i2c->dev, sizeof *wm8985, GFP_KERNEL); |
1121 | if (!wm8985) | 1118 | if (!wm8985) |
1122 | return -ENOMEM; | 1119 | return -ENOMEM; |
1123 | 1120 | ||
@@ -1126,15 +1123,12 @@ static __devinit int wm8985_i2c_probe(struct i2c_client *i2c, | |||
1126 | 1123 | ||
1127 | ret = snd_soc_register_codec(&i2c->dev, | 1124 | ret = snd_soc_register_codec(&i2c->dev, |
1128 | &soc_codec_dev_wm8985, &wm8985_dai, 1); | 1125 | &soc_codec_dev_wm8985, &wm8985_dai, 1); |
1129 | if (ret < 0) | ||
1130 | kfree(wm8985); | ||
1131 | return ret; | 1126 | return ret; |
1132 | } | 1127 | } |
1133 | 1128 | ||
1134 | static __devexit int wm8985_i2c_remove(struct i2c_client *client) | 1129 | static __devexit int wm8985_i2c_remove(struct i2c_client *client) |
1135 | { | 1130 | { |
1136 | snd_soc_unregister_codec(&client->dev); | 1131 | snd_soc_unregister_codec(&client->dev); |
1137 | kfree(i2c_get_clientdata(client)); | ||
1138 | return 0; | 1132 | return 0; |
1139 | } | 1133 | } |
1140 | 1134 | ||