mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
ASoC: tegra-alt: Fix error path for rt565x machine driver
The error path of the Tegra210 rt565x machine driver does not unregister the headset switch on failure. Failure to unregister the headset switch on failure prevents causes subsequent calls to register a switch to fail because one is already registered. Hence, if the probe of the rt565x machine driver is deferred, for example because the codec is not register yet, this will cause subsequent probe attempts to fail because a switch is already registered. Fix the above issues by unregistering the switch in the error path of the Tegra210 rt565x machine driver probe. Finally ensure the switch is unregistered in the removal of the rt565x machine driver. Bug 2044665 Change-Id: Iaeb6f7ae30b6fdff46b0a8679003674804399a99 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1634166 (cherry picked from commit 1a9cea0e8e97c5b042088d5988184c81db85ea6a) Reviewed-on: https://git-master.nvidia.com/r/1642330 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* tegra_machine_driver_mobile.c - Tegra ASoC Machine driver for mobile
|
* tegra_machine_driver_mobile.c - Tegra ASoC Machine driver for mobile
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2017-2018 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -1229,7 +1229,8 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
|
|||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
"Can't allocate tegra_asoc_platform_data struct\n");
|
"Can't allocate tegra_asoc_platform_data struct\n");
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto err_switch_unregister;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata->gpio_codec1 = pdata->gpio_codec2 = pdata->gpio_codec3 =
|
pdata->gpio_codec1 = pdata->gpio_codec2 = pdata->gpio_codec3 =
|
||||||
@@ -1243,13 +1244,13 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
|
|||||||
&pdev->dev,
|
&pdev->dev,
|
||||||
card);
|
card);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_alloc_dai_link;
|
goto err_switch_unregister;
|
||||||
|
|
||||||
ret = snd_soc_register_card(card);
|
ret = snd_soc_register_card(card);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
|
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
|
||||||
ret);
|
ret);
|
||||||
goto err_alloc_dai_link;
|
goto err_switch_unregister;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtd = snd_soc_get_pcm_runtime(card, "rt565x-playback");
|
rtd = snd_soc_get_pcm_runtime(card, "rt565x-playback");
|
||||||
@@ -1274,6 +1275,10 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_switch_unregister:
|
||||||
|
#ifdef CONFIG_SWITCH
|
||||||
|
tegra_alt_asoc_switch_unregister(&tegra_machine_headset_switch);
|
||||||
|
#endif
|
||||||
err_alloc_dai_link:
|
err_alloc_dai_link:
|
||||||
tegra_machine_remove_dai_link();
|
tegra_machine_remove_dai_link();
|
||||||
tegra_machine_remove_codec_conf();
|
tegra_machine_remove_codec_conf();
|
||||||
@@ -1287,6 +1292,9 @@ static int tegra_machine_driver_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
snd_soc_unregister_card(card);
|
snd_soc_unregister_card(card);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SWITCH
|
||||||
|
tegra_alt_asoc_switch_unregister(&tegra_machine_headset_switch);
|
||||||
|
#endif
|
||||||
tegra_machine_remove_dai_link();
|
tegra_machine_remove_dai_link();
|
||||||
tegra_machine_remove_codec_conf();
|
tegra_machine_remove_codec_conf();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user