Skip to contentSkip to conversation

regulator: Remove NULL test before calling regulator_unregister()

PATCH Applied Axel Lin 2 participants 2 messages Apr 27, 2013 – Apr 28, 2013

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

Cc Robert Jarzmik <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Sangbeom Kim <[email protected]>
Cc Cyril Chemparathy <[email protected]>
---
 drivers/regulator/max1586.c            |    3 +--
 drivers/regulator/max8649.c            |    6 ++----
 drivers/regulator/max8660.c            |    3 +--
 drivers/regulator/s5m8767.c            |    6 ++----
 drivers/regulator/tps6524x-regulator.c |    3 +--
 5 files changed, 7 insertions(+), 14 deletions(-)
drivers/regulator/max1586.c +1 -2
index dac0490..54af610 100644
@@ -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;
 }
 
drivers/regulator/max8649.c +2 -4
index fdb67ff..db6c9be 100644
@@ -248,10 +248,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;
 }
drivers/regulator/max8660.c +1 -2
index 4d7c635..d428ef9 100644
@@ -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;
 }
 
drivers/regulator/s5m8767.c +2 -4
index 8e56198..c24448b 100644
@@ -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;
 }
drivers/regulator/tps6524x-regulator.c +1 -2
index 18b67d2..1094393 100644
@@ -585,8 +585,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);
Signature · 1 line
1.7.10.4
maintainer Applied
#1 lore raw
Quoted 2 lines · Axel Lin

It's safe to call regulator_unregister() with NULL, thus remove the NULL test before regulator_unregister() calls.

Applied, thanks.