soc: tegra: fix coverity errors
Dara Ramesh [Tue, 5 Mar 2013 10:44:53 +0000 (15:44 +0530)]
fix memory cleanup and array comparison with null.

Change-Id: Ib27b0814c2744024f36fa3f3f510927eceb490a1
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: http://git-master/r/206284
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>

sound/soc/tegra/tegra_aic326x.c
sound/soc/tegra/tegra_cs42l73.c

index 54e7c8f..d66fcba 100644 (file)
@@ -1621,7 +1621,7 @@ static __devinit int tegra_aic326x_driver_probe(struct platform_device *pdev)
        }
 #endif
 
-       if (pdata->edp_states == NULL)
+       if (!pdata->edp_support)
                return 0;
 
        machine->spk_edp_client = devm_kzalloc(&pdev->dev,
@@ -1642,6 +1642,8 @@ static __devinit int tegra_aic326x_driver_probe(struct platform_device *pdev)
 
        battery_manager = edp_get_manager("battery");
        if (!battery_manager) {
+               devm_kfree(&pdev->dev, machine->spk_edp_client);
+               machine->spk_edp_client = NULL;
                dev_err(&pdev->dev, "unable to get edp manager\n");
        } else {
                /* register speaker edp client */
index 2652f15..050984a 100644 (file)
@@ -1432,7 +1432,7 @@ static __devinit int tegra_cs42l73_driver_probe(struct platform_device *pdev)
                goto err_unregister_card;
        }
 
-       if (pdata->edp_states == NULL)
+       if (!pdata->edp_support)
                return 0;
 
        machine->spk_edp_client = devm_kzalloc(&pdev->dev,
@@ -1453,6 +1453,8 @@ static __devinit int tegra_cs42l73_driver_probe(struct platform_device *pdev)
 
        battery_manager = edp_get_manager("battery");
        if (!battery_manager) {
+               devm_kfree(&pdev->dev, machine->spk_edp_client);
+               machine->spk_edp_client = NULL;
                dev_err(&pdev->dev, "unable to get edp manager\n");
        } else {
                /* register speaker edp client */