Skip to content

Commit e9802c5

Browse files
AxelLinbroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent b63d4d1 commit e9802c5

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

sound/soc/codecs/rt5514-spi.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -410,32 +410,20 @@ static int rt5514_spi_probe(struct spi_device *spi)
410410

411411
rt5514_spi = spi;
412412

413-
ret = snd_soc_register_platform(&spi->dev, &rt5514_spi_platform);
413+
ret = devm_snd_soc_register_platform(&spi->dev, &rt5514_spi_platform);
414414
if (ret < 0) {
415415
dev_err(&spi->dev, "Failed to register platform.\n");
416-
goto err_plat;
416+
return ret;
417417
}
418418

419-
ret = snd_soc_register_component(&spi->dev, &rt5514_spi_dai_component,
420-
&rt5514_spi_dai, 1);
419+
ret = devm_snd_soc_register_component(&spi->dev,
420+
&rt5514_spi_dai_component,
421+
&rt5514_spi_dai, 1);
421422
if (ret < 0) {
422423
dev_err(&spi->dev, "Failed to register component.\n");
423-
goto err_comp;
424+
return ret;
424425
}
425426

426-
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-
439427
return 0;
440428
}
441429

@@ -451,7 +439,6 @@ static struct spi_driver rt5514_spi_driver = {
451439
.of_match_table = of_match_ptr(rt5514_of_match),
452440
},
453441
.probe = rt5514_spi_probe,
454-
.remove = rt5514_spi_remove,
455442
};
456443
module_spi_driver(rt5514_spi_driver);
457444

0 commit comments

Comments
 (0)