asoc: max98095: probe with no device there fix
Rhyland Klein [Wed, 6 Jun 2012 19:28:40 +0000 (15:28 -0400)]
There is path through which registering a card will fail to probe,
but that error code is not propogated back to the tegra machine
driver. To catch this case in the machine driver's probe routine,
we need to ensure that after registering the card, the card is
instantiated and fail probe if not.

Change-Id: I64ba952685ef193a3b248502943771c518396808
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-on: http://git-master/r/106837
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Scott Peterson <speterson@nvidia.com>

sound/soc/tegra/tegra_max98095.c

index b3bed37..701571d 100644 (file)
@@ -658,8 +658,17 @@ static __devinit int tegra_max98095_driver_probe(struct platform_device *pdev)
                goto err_switch_unregister;
        }
 
+       if (!card->instantiated) {
+               ret = -ENODEV;
+               dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
+                               ret);
+               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);