aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2012-11-21 23:08:35 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-11-23 09:32:31 -0500
commitd5ff3c8a51a79876b9489bed7c314e4a792370f5 (patch)
tree48c2e4a564af7bfab58ad856858441c7639d9716
parentf4a75d2eb7b1e2206094b901be09adb31ba63681 (diff)
ASoC: wm8995: Convert to use devm_kzalloc()
Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/wm8995.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 28c89b094c6e..2eb68c16db31 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -2261,7 +2261,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
2261 struct wm8995_priv *wm8995; 2261 struct wm8995_priv *wm8995;
2262 int ret; 2262 int ret;
2263 2263
2264 wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL); 2264 wm8995 = devm_kzalloc(&spi->dev, sizeof(*wm8995), GFP_KERNEL);
2265 if (!wm8995) 2265 if (!wm8995)
2266 return -ENOMEM; 2266 return -ENOMEM;
2267 2267
@@ -2271,7 +2271,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
2271 if (IS_ERR(wm8995->regmap)) { 2271 if (IS_ERR(wm8995->regmap)) {
2272 ret = PTR_ERR(wm8995->regmap); 2272 ret = PTR_ERR(wm8995->regmap);
2273 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret); 2273 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret);
2274 goto err_alloc; 2274 return ret;
2275 } 2275 }
2276 2276
2277 ret = snd_soc_register_codec(&spi->dev, 2277 ret = snd_soc_register_codec(&spi->dev,
@@ -2284,8 +2284,6 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
2284 2284
2285err_regmap: 2285err_regmap:
2286 regmap_exit(wm8995->regmap); 2286 regmap_exit(wm8995->regmap);
2287err_alloc:
2288 kfree(wm8995);
2289 2287
2290 return ret; 2288 return ret;
2291} 2289}
@@ -2295,7 +2293,6 @@ static int __devexit wm8995_spi_remove(struct spi_device *spi)
2295 struct wm8995_priv *wm8995 = spi_get_drvdata(spi); 2293 struct wm8995_priv *wm8995 = spi_get_drvdata(spi);
2296 snd_soc_unregister_codec(&spi->dev); 2294 snd_soc_unregister_codec(&spi->dev);
2297 regmap_exit(wm8995->regmap); 2295 regmap_exit(wm8995->regmap);
2298 kfree(wm8995);
2299 return 0; 2296 return 0;
2300} 2297}
2301 2298
@@ -2316,7 +2313,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
2316 struct wm8995_priv *wm8995; 2313 struct wm8995_priv *wm8995;
2317 int ret; 2314 int ret;
2318 2315
2319 wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL); 2316 wm8995 = devm_kzalloc(&i2c->dev, sizeof(*wm8995), GFP_KERNEL);
2320 if (!wm8995) 2317 if (!wm8995)
2321 return -ENOMEM; 2318 return -ENOMEM;
2322 2319
@@ -2326,7 +2323,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
2326 if (IS_ERR(wm8995->regmap)) { 2323 if (IS_ERR(wm8995->regmap)) {
2327 ret = PTR_ERR(wm8995->regmap); 2324 ret = PTR_ERR(wm8995->regmap);
2328 dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret); 2325 dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret);
2329 goto err_alloc; 2326 return ret;
2330 } 2327 }
2331 2328
2332 ret = snd_soc_register_codec(&i2c->dev, 2329 ret = snd_soc_register_codec(&i2c->dev,
@@ -2341,8 +2338,6 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
2341 2338
2342err_regmap: 2339err_regmap:
2343 regmap_exit(wm8995->regmap); 2340 regmap_exit(wm8995->regmap);
2344err_alloc:
2345 kfree(wm8995);
2346 2341
2347 return ret; 2342 return ret;
2348} 2343}
@@ -2353,7 +2348,6 @@ static __devexit int wm8995_i2c_remove(struct i2c_client *client)
2353 2348
2354 snd_soc_unregister_codec(&client->dev); 2349 snd_soc_unregister_codec(&client->dev);
2355 regmap_exit(wm8995->regmap); 2350 regmap_exit(wm8995->regmap);
2356 kfree(wm8995);
2357 return 0; 2351 return 0;
2358} 2352}
2359 2353