diff options
author | Axel Lin <axel.lin@ingics.com> | 2016-07-14 04:57:05 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-07-14 05:56:54 -0400 |
commit | e9802c579399904bfef828e1a77b777b96ea33db (patch) | |
tree | 77e0bf3a07c40f248693bcdc18fe3eacb41555b3 /sound/soc | |
parent | b63d4d13ac7b8f947407a7eb44fdc40fadc8c5b8 (diff) |
ASoC: rt5514-spi: Convert to use devm_* API
Use devm_* API to simplify the code.
This patch also fixes the return value in probe error paths.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/rt5514-spi.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index 743f509d48b7..77ff8ebe6dfb 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c | |||
@@ -410,33 +410,21 @@ static int rt5514_spi_probe(struct spi_device *spi) | |||
410 | 410 | ||
411 | rt5514_spi = spi; | 411 | rt5514_spi = spi; |
412 | 412 | ||
413 | ret = snd_soc_register_platform(&spi->dev, &rt5514_spi_platform); | 413 | ret = devm_snd_soc_register_platform(&spi->dev, &rt5514_spi_platform); |
414 | if (ret < 0) { | 414 | if (ret < 0) { |
415 | dev_err(&spi->dev, "Failed to register platform.\n"); | 415 | dev_err(&spi->dev, "Failed to register platform.\n"); |
416 | goto err_plat; | 416 | return ret; |
417 | } | 417 | } |
418 | 418 | ||
419 | ret = snd_soc_register_component(&spi->dev, &rt5514_spi_dai_component, | 419 | ret = devm_snd_soc_register_component(&spi->dev, |
420 | &rt5514_spi_dai, 1); | 420 | &rt5514_spi_dai_component, |
421 | &rt5514_spi_dai, 1); | ||
421 | if (ret < 0) { | 422 | if (ret < 0) { |
422 | dev_err(&spi->dev, "Failed to register component.\n"); | 423 | dev_err(&spi->dev, "Failed to register component.\n"); |
423 | goto err_comp; | 424 | return ret; |
424 | } | 425 | } |
425 | 426 | ||
426 | return 0; | 427 | return 0; |
427 | err_comp: | ||
428 | snd_soc_unregister_platform(&spi->dev); | ||
429 | err_plat: | ||
430 | |||
431 | return 0; | ||
432 | } | ||
433 | |||
434 | static int rt5514_spi_remove(struct spi_device *spi) | ||
435 | { | ||
436 | snd_soc_unregister_component(&spi->dev); | ||
437 | snd_soc_unregister_platform(&spi->dev); | ||
438 | |||
439 | return 0; | ||
440 | } | 428 | } |
441 | 429 | ||
442 | static const struct of_device_id rt5514_of_match[] = { | 430 | static const struct of_device_id rt5514_of_match[] = { |
@@ -451,7 +439,6 @@ static struct spi_driver rt5514_spi_driver = { | |||
451 | .of_match_table = of_match_ptr(rt5514_of_match), | 439 | .of_match_table = of_match_ptr(rt5514_of_match), |
452 | }, | 440 | }, |
453 | .probe = rt5514_spi_probe, | 441 | .probe = rt5514_spi_probe, |
454 | .remove = rt5514_spi_remove, | ||
455 | }; | 442 | }; |
456 | module_spi_driver(rt5514_spi_driver); | 443 | module_spi_driver(rt5514_spi_driver); |
457 | 444 | ||