asoc: tegra: max98088 machine: check for card instantiation
Nikesh Oswal [Wed, 14 Mar 2012 12:16:24 +0000 (17:16 +0530)]
If card fails to instantiate then unregister the card

Change-Id: Ibcc0d505a8df48c1f924a3d8688dc23e362d5e8d
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: http://git-master/r/90060
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

sound/soc/tegra/tegra_max98088.c

index 1a46501..7f17667 100644 (file)
@@ -1157,8 +1157,15 @@ static __devinit int tegra_max98088_driver_probe(struct platform_device *pdev)
                goto err_switch_unregister;
        }
 
+       if (!card->instantiated) {
+               dev_err(&pdev->dev, "No MAX98088 codec\n");
+               goto err_unregister_card;
+       }
+
        return 0;
 
+err_unregister_card:
+       snd_soc_unregister_card(card);
 err_switch_unregister:
 #ifdef CONFIG_SWITCH
        switch_dev_unregister(&wired_switch_dev);