diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-03 12:17:05 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-03 16:35:07 -0500 |
commit | 5aefb306e35541d35c8d5838ae97f3f9d8ad1a12 (patch) | |
tree | ae2be330069ff61333bf96e3ef16249e75664254 | |
parent | b903c0ed2e85155c3a67cfc54117223a61bb483f (diff) |
ASoC: Convert WM8741 to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8741.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index bf471dc57114..24d8ec53f35b 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c | |||
@@ -503,7 +503,8 @@ static int wm8741_i2c_probe(struct i2c_client *i2c, | |||
503 | struct wm8741_priv *wm8741; | 503 | struct wm8741_priv *wm8741; |
504 | int ret; | 504 | int ret; |
505 | 505 | ||
506 | wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL); | 506 | wm8741 = devm_kzalloc(&i2c->dev, sizeof(struct wm8741_priv), |
507 | GFP_KERNEL); | ||
507 | if (wm8741 == NULL) | 508 | if (wm8741 == NULL) |
508 | return -ENOMEM; | 509 | return -ENOMEM; |
509 | 510 | ||
@@ -512,20 +513,13 @@ static int wm8741_i2c_probe(struct i2c_client *i2c, | |||
512 | 513 | ||
513 | ret = snd_soc_register_codec(&i2c->dev, | 514 | ret = snd_soc_register_codec(&i2c->dev, |
514 | &soc_codec_dev_wm8741, &wm8741_dai, 1); | 515 | &soc_codec_dev_wm8741, &wm8741_dai, 1); |
515 | if (ret != 0) | ||
516 | goto err; | ||
517 | 516 | ||
518 | return ret; | 517 | return ret; |
519 | |||
520 | err: | ||
521 | kfree(wm8741); | ||
522 | return ret; | ||
523 | } | 518 | } |
524 | 519 | ||
525 | static int wm8741_i2c_remove(struct i2c_client *client) | 520 | static int wm8741_i2c_remove(struct i2c_client *client) |
526 | { | 521 | { |
527 | snd_soc_unregister_codec(&client->dev); | 522 | snd_soc_unregister_codec(&client->dev); |
528 | kfree(i2c_get_clientdata(client)); | ||
529 | return 0; | 523 | return 0; |
530 | } | 524 | } |
531 | 525 | ||
@@ -553,7 +547,8 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi) | |||
553 | struct wm8741_priv *wm8741; | 547 | struct wm8741_priv *wm8741; |
554 | int ret; | 548 | int ret; |
555 | 549 | ||
556 | wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL); | 550 | wm8741 = devm_kzalloc(&spi->dev, sizeof(struct wm8741_priv), |
551 | GFP_KERNEL); | ||
557 | if (wm8741 == NULL) | 552 | if (wm8741 == NULL) |
558 | return -ENOMEM; | 553 | return -ENOMEM; |
559 | 554 | ||
@@ -562,15 +557,12 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi) | |||
562 | 557 | ||
563 | ret = snd_soc_register_codec(&spi->dev, | 558 | ret = snd_soc_register_codec(&spi->dev, |
564 | &soc_codec_dev_wm8741, &wm8741_dai, 1); | 559 | &soc_codec_dev_wm8741, &wm8741_dai, 1); |
565 | if (ret < 0) | ||
566 | kfree(wm8741); | ||
567 | return ret; | 560 | return ret; |
568 | } | 561 | } |
569 | 562 | ||
570 | static int __devexit wm8741_spi_remove(struct spi_device *spi) | 563 | static int __devexit wm8741_spi_remove(struct spi_device *spi) |
571 | { | 564 | { |
572 | snd_soc_unregister_codec(&spi->dev); | 565 | snd_soc_unregister_codec(&spi->dev); |
573 | kfree(spi_get_drvdata(spi)); | ||
574 | return 0; | 566 | return 0; |
575 | } | 567 | } |
576 | 568 | ||