aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-26 07:51:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-28 12:22:40 -0500
commit30c88f2ca89d6c0706ab585beca3730c9d7524de (patch)
tree8047677e2a1d8654e0a9b0da3883ae021b776416 /sound/soc/codecs
parenta5b683489fd3c83f3951eccdc6aee14f50474dda (diff)
ASoC: Convert ad193x to devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/ad193x.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index c1b7d928c347..a4a6bef2c0bb 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -385,14 +385,15 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi)
385 struct ad193x_priv *ad193x; 385 struct ad193x_priv *ad193x;
386 int ret; 386 int ret;
387 387
388 ad193x = kzalloc(sizeof(struct ad193x_priv), GFP_KERNEL); 388 ad193x = devm_kzalloc(&spi->dev, sizeof(struct ad193x_priv),
389 GFP_KERNEL);
389 if (ad193x == NULL) 390 if (ad193x == NULL)
390 return -ENOMEM; 391 return -ENOMEM;
391 392
392 ad193x->regmap = regmap_init_spi(spi, &ad193x_spi_regmap_config); 393 ad193x->regmap = regmap_init_spi(spi, &ad193x_spi_regmap_config);
393 if (IS_ERR(ad193x->regmap)) { 394 if (IS_ERR(ad193x->regmap)) {
394 ret = PTR_ERR(ad193x->regmap); 395 ret = PTR_ERR(ad193x->regmap);
395 goto err_free; 396 goto err_out;
396 } 397 }
397 398
398 spi_set_drvdata(spi, ad193x); 399 spi_set_drvdata(spi, ad193x);
@@ -406,9 +407,7 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi)
406 407
407err_regmap_exit: 408err_regmap_exit:
408 regmap_exit(ad193x->regmap); 409 regmap_exit(ad193x->regmap);
409err_free: 410err_out:
410 kfree(ad193x);
411
412 return ret; 411 return ret;
413} 412}
414 413
@@ -418,7 +417,6 @@ static int __devexit ad193x_spi_remove(struct spi_device *spi)
418 417
419 snd_soc_unregister_codec(&spi->dev); 418 snd_soc_unregister_codec(&spi->dev);
420 regmap_exit(ad193x->regmap); 419 regmap_exit(ad193x->regmap);
421 kfree(ad193x);
422 return 0; 420 return 0;
423} 421}
424 422
@@ -455,14 +453,15 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client,
455 struct ad193x_priv *ad193x; 453 struct ad193x_priv *ad193x;
456 int ret; 454 int ret;
457 455
458 ad193x = kzalloc(sizeof(struct ad193x_priv), GFP_KERNEL); 456 ad193x = devm_kzalloc(&client->dev, sizeof(struct ad193x_priv),
457 GFP_KERNEL);
459 if (ad193x == NULL) 458 if (ad193x == NULL)
460 return -ENOMEM; 459 return -ENOMEM;
461 460
462 ad193x->regmap = regmap_init_i2c(client, &ad193x_i2c_regmap_config); 461 ad193x->regmap = regmap_init_i2c(client, &ad193x_i2c_regmap_config);
463 if (IS_ERR(ad193x->regmap)) { 462 if (IS_ERR(ad193x->regmap)) {
464 ret = PTR_ERR(ad193x->regmap); 463 ret = PTR_ERR(ad193x->regmap);
465 goto err_free; 464 goto err_out;
466 } 465 }
467 466
468 i2c_set_clientdata(client, ad193x); 467 i2c_set_clientdata(client, ad193x);
@@ -476,8 +475,7 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client,
476 475
477err_regmap_exit: 476err_regmap_exit:
478 regmap_exit(ad193x->regmap); 477 regmap_exit(ad193x->regmap);
479err_free: 478err_out:
480 kfree(ad193x);
481 return ret; 479 return ret;
482} 480}
483 481
@@ -487,7 +485,6 @@ static int __devexit ad193x_i2c_remove(struct i2c_client *client)
487 485
488 snd_soc_unregister_codec(&client->dev); 486 snd_soc_unregister_codec(&client->dev);
489 regmap_exit(ad193x->regmap); 487 regmap_exit(ad193x->regmap);
490 kfree(ad193x);
491 return 0; 488 return 0;
492} 489}
493 490