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
(cherry picked from commit 1b7d7b6c39d45a84135d66c7cf784dc4bbee788e)
Reviewed-on: http://git-master/r/199174
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/dvfs.c

index 9fe9f57..4cbbc13 100644 (file)
@@ -703,6 +703,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) {
@@ -713,11 +716,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;