diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-04-27 01:58:08 -0400 |
---|---|---|
committer | Mark Brown <broonie@sirena.org.uk> | 2013-04-27 21:11:19 -0400 |
commit | 020501f1a0911af70873e4d3d122b2e1889ccd03 (patch) | |
tree | 0a5692eb87cfaf0b7ec46ac845a1d79a9fd576d8 /drivers/regulator | |
parent | 1e4b545cdd93318379c6b1fb0a99536fa3260f53 (diff) |
regulator: Remove NULL test before calling regulator_unregister()
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max1586.c | 3 | ||||
-rw-r--r-- | drivers/regulator/max8649.c | 6 | ||||
-rw-r--r-- | drivers/regulator/max8660.c | 3 | ||||
-rw-r--r-- | drivers/regulator/s5m8767.c | 6 | ||||
-rw-r--r-- | drivers/regulator/tps6524x-regulator.c | 3 |
5 files changed, 7 insertions, 14 deletions
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 8c5a54f541b5..6b2217b404b2 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c | |||
@@ -232,8 +232,7 @@ static int max1586_pmic_remove(struct i2c_client *client) | |||
232 | int i; | 232 | int i; |
233 | 233 | ||
234 | for (i = 0; i <= MAX1586_V6; i++) | 234 | for (i = 0; i <= MAX1586_V6; i++) |
235 | if (max1586->rdev[i]) | 235 | regulator_unregister(max1586->rdev[i]); |
236 | regulator_unregister(max1586->rdev[i]); | ||
237 | return 0; | 236 | return 0; |
238 | } | 237 | } |
239 | 238 | ||
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 3ca14380f22d..f44427003611 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -275,10 +275,8 @@ static int max8649_regulator_remove(struct i2c_client *client) | |||
275 | { | 275 | { |
276 | struct max8649_regulator_info *info = i2c_get_clientdata(client); | 276 | struct max8649_regulator_info *info = i2c_get_clientdata(client); |
277 | 277 | ||
278 | if (info) { | 278 | if (info) |
279 | if (info->regulator) | 279 | regulator_unregister(info->regulator); |
280 | regulator_unregister(info->regulator); | ||
281 | } | ||
282 | 280 | ||
283 | return 0; | 281 | return 0; |
284 | } | 282 | } |
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index 4d7c635c36c2..d428ef9a626f 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c | |||
@@ -426,8 +426,7 @@ static int max8660_remove(struct i2c_client *client) | |||
426 | int i; | 426 | int i; |
427 | 427 | ||
428 | for (i = 0; i < MAX8660_V_END; i++) | 428 | for (i = 0; i < MAX8660_V_END; i++) |
429 | if (max8660->rdev[i]) | 429 | regulator_unregister(max8660->rdev[i]); |
430 | regulator_unregister(max8660->rdev[i]); | ||
431 | return 0; | 430 | return 0; |
432 | } | 431 | } |
433 | 432 | ||
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 8a831947c351..2dd74e254397 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -923,8 +923,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | |||
923 | return 0; | 923 | return 0; |
924 | err: | 924 | err: |
925 | for (i = 0; i < s5m8767->num_regulators; i++) | 925 | for (i = 0; i < s5m8767->num_regulators; i++) |
926 | if (rdev[i]) | 926 | regulator_unregister(rdev[i]); |
927 | regulator_unregister(rdev[i]); | ||
928 | 927 | ||
929 | return ret; | 928 | return ret; |
930 | } | 929 | } |
@@ -936,8 +935,7 @@ static int s5m8767_pmic_remove(struct platform_device *pdev) | |||
936 | int i; | 935 | int i; |
937 | 936 | ||
938 | for (i = 0; i < s5m8767->num_regulators; i++) | 937 | for (i = 0; i < s5m8767->num_regulators; i++) |
939 | if (rdev[i]) | 938 | regulator_unregister(rdev[i]); |
940 | regulator_unregister(rdev[i]); | ||
941 | 939 | ||
942 | return 0; | 940 | return 0; |
943 | } | 941 | } |
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index 843ee0a9bb92..06e92761afdd 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c | |||
@@ -584,8 +584,7 @@ static int pmic_remove(struct spi_device *spi) | |||
584 | if (!hw) | 584 | if (!hw) |
585 | return 0; | 585 | return 0; |
586 | for (i = 0; i < N_REGULATORS; i++) { | 586 | for (i = 0; i < N_REGULATORS; i++) { |
587 | if (hw->rdev[i]) | 587 | regulator_unregister(hw->rdev[i]); |
588 | regulator_unregister(hw->rdev[i]); | ||
589 | hw->rdev[i] = NULL; | 588 | hw->rdev[i] = NULL; |
590 | } | 589 | } |
591 | spi_set_drvdata(spi, NULL); | 590 | spi_set_drvdata(spi, NULL); |