regulator: Remove NULL test before calling regulator_unregister()
authorAxel Lin <axel.lin@ingics.com>
Sat, 27 Apr 2013 05:58:08 +0000 (13:58 +0800)
committerMark Brown <broonie@sirena.org.uk>
Sun, 28 Apr 2013 01:11:19 +0000 (02:11 +0100)
It's safe to call regulator_unregister() with NULL, thus remove the NULL test
before regulator_unregister() calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
drivers/regulator/max1586.c
drivers/regulator/max8649.c
drivers/regulator/max8660.c
drivers/regulator/s5m8767.c
drivers/regulator/tps6524x-regulator.c

index 8c5a54f541b50964567ba739a128b0ae59ec286a..6b2217b404b2fb29b9858b312bc51b09931db5d7 100644 (file)
@@ -232,8 +232,7 @@ static int max1586_pmic_remove(struct i2c_client *client)
        int i;
 
        for (i = 0; i <= MAX1586_V6; i++)
-               if (max1586->rdev[i])
-                       regulator_unregister(max1586->rdev[i]);
+               regulator_unregister(max1586->rdev[i]);
        return 0;
 }
 
index 3ca14380f22db06aba4338544cf62967d48fa900..f44427003611f3876ddc076cd88e312eaf349052 100644 (file)
@@ -275,10 +275,8 @@ static int max8649_regulator_remove(struct i2c_client *client)
 {
        struct max8649_regulator_info *info = i2c_get_clientdata(client);
 
-       if (info) {
-               if (info->regulator)
-                       regulator_unregister(info->regulator);
-       }
+       if (info)
+               regulator_unregister(info->regulator);
 
        return 0;
 }
index 4d7c635c36c2d6cc92b1ecd8fafb9d533213ae21..d428ef9a626fefde45c5e8487f3ec3125abe05c8 100644 (file)
@@ -426,8 +426,7 @@ static int max8660_remove(struct i2c_client *client)
        int i;
 
        for (i = 0; i < MAX8660_V_END; i++)
-               if (max8660->rdev[i])
-                       regulator_unregister(max8660->rdev[i]);
+               regulator_unregister(max8660->rdev[i]);
        return 0;
 }
 
index 8a831947c351152bb52b886d81eef232eb5794c6..2dd74e254397cfb0cd1ad0af7f3c2aa635b78097 100644 (file)
@@ -923,8 +923,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
        return 0;
 err:
        for (i = 0; i < s5m8767->num_regulators; i++)
-               if (rdev[i])
-                       regulator_unregister(rdev[i]);
+               regulator_unregister(rdev[i]);
 
        return ret;
 }
@@ -936,8 +935,7 @@ static int s5m8767_pmic_remove(struct platform_device *pdev)
        int i;
 
        for (i = 0; i < s5m8767->num_regulators; i++)
-               if (rdev[i])
-                       regulator_unregister(rdev[i]);
+               regulator_unregister(rdev[i]);
 
        return 0;
 }
index 843ee0a9bb92ce2a23e7a2209590b99cfa13e76c..06e92761afdd05056720a8a20ca8a11eef0eefa2 100644 (file)
@@ -584,8 +584,7 @@ static int pmic_remove(struct spi_device *spi)
        if (!hw)
                return 0;
        for (i = 0; i < N_REGULATORS; i++) {
-               if (hw->rdev[i])
-                       regulator_unregister(hw->rdev[i]);
+               regulator_unregister(hw->rdev[i]);
                hw->rdev[i] = NULL;
        }
        spi_set_drvdata(spi, NULL);