ASoC: tegra-alt: vcm30t124: Cleanup error path
Songhee Baek [Fri, 13 Dec 2013 18:35:34 +0000 (10:35 -0800)]
When sound card registeration is failed, vcm30t124 needs release
max9485 i2c client, and gpio request for other sound card to use
those resources and it makes other machine driver be probed
properly.

Bug 1413475

Change-Id: I202f79fee94bc072107017f7e075094a1dc780b3
Reviewed-on: http://git-master/r/345389
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Songhee Baek <sbaek@nvidia.com>
Reviewed-by: Gajanan Bhat <gbhat@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Reviewed-by: Bob Johnston <bjohnston@nvidia.com>

sound/soc/tegra-alt/tegra_vcm30t124_alt.c

index 04293a2..8316baa 100644 (file)
@@ -973,14 +973,14 @@ static int tegra_vcm30t124_driver_probe(struct platform_device *pdev)
                                "dap_dir_control");
        if (ret) {
                dev_err(&pdev->dev, "cannot get dap_dir_control gpio\n");
-               goto err;
+               goto err_i2c_unregister;
        }
 
        ret = tegra_alt_asoc_utils_init(&machine->audio_clock,
                                        &pdev->dev,
                                        card);
        if (ret)
-               goto err;
+               goto err_gpio_free;
 
        ret = snd_soc_register_card(card);
        if (ret) {
@@ -993,8 +993,11 @@ static int tegra_vcm30t124_driver_probe(struct platform_device *pdev)
 
 err_fini_utils:
        tegra_alt_asoc_utils_fini(&machine->audio_clock);
+err_gpio_free:
+       devm_gpio_free(&pdev->dev, machine->gpio_dap_direction);
+err_i2c_unregister:
+       i2c_unregister_device(machine->max9485_client);
 err:
-       dev_err(&pdev->dev, "Failed at utils_init\n");
        return ret;
 }
 
@@ -1006,6 +1009,8 @@ static int tegra_vcm30t124_driver_remove(struct platform_device *pdev)
        snd_soc_unregister_card(card);
 
        tegra_alt_asoc_utils_fini(&machine->audio_clock);
+       devm_gpio_free(&pdev->dev, machine->gpio_dap_direction);
+       i2c_unregister_device(machine->max9485_client);
 
        return 0;
 }