ARM: tegra: dvfs: Add rail NULL-pointer check
Alex Frid [Sun, 3 Feb 2013 05:51:27 +0000 (21:51 -0800)]
Add rail NULL-pointer check in public interfaces.

Change-Id: If4174471d6d9ce6935316db72ec5bf273cb2b486
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/196775
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>

arch/arm/mach-tegra/dvfs.c

index 50e4ae7..74d7e7a 100644 (file)
@@ -705,6 +705,9 @@ static void __tegra_dvfs_rail_enable(struct dvfs_rail *rail)
 
 void tegra_dvfs_rail_enable(struct dvfs_rail *rail)
 {
+       if (!rail)
+               return;
+
        mutex_lock(&rail_disable_lock);
 
        if (rail->disabled) {
@@ -715,11 +718,13 @@ void tegra_dvfs_rail_enable(struct dvfs_rail *rail)
                tegra_dvfs_rail_post_enable(rail);
        }
        mutex_unlock(&rail_disable_lock);
-
 }
 
 void tegra_dvfs_rail_disable(struct dvfs_rail *rail)
 {
+       if (!rail)
+               return;
+
        mutex_lock(&rail_disable_lock);
        if (rail->disabled)
                goto out;