diff mbox

[10/15] power-supply: Drop useless 'if (ret.intval)' statements

Message ID 757d201831cd8187644fc50705a8415e44237e00.1409831636.git.viresh.kumar@linaro.org
State Accepted
Commit 1c42a389eaa0fddca6e6d9625e65ff62c9b90e80
Headers show

Commit Message

Viresh Kumar Sept. 4, 2014, 12:01 p.m. UTC
There is no need to check the value of ret.intval before returning it, as we
will be returning zero explicitly when ret.intval is zero.

So essentially we will end up returning value of ret.intval as it is. Drop the
unnecessary 'if' statements.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/power/power_supply_core.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 55140eb..bcff7fd 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -265,10 +265,8 @@  static int __power_supply_am_i_supplied(struct device *dev, void *data)
 	struct power_supply *epsy = dev_get_drvdata(dev);
 
 	if (__power_supply_is_supplied_by(epsy, psy))
-		if (!epsy->get_property(epsy, POWER_SUPPLY_PROP_ONLINE, &ret)) {
-			if (ret.intval)
-				return ret.intval;
-		}
+		if (!epsy->get_property(epsy, POWER_SUPPLY_PROP_ONLINE, &ret))
+			return ret.intval;
 
 	return 0;
 }
@@ -293,12 +291,10 @@  static int __power_supply_is_system_supplied(struct device *dev, void *data)
 	unsigned int *count = data;
 
 	(*count)++;
-	if (psy->type != POWER_SUPPLY_TYPE_BATTERY) {
-		if (psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &ret))
-			return 0;
-		if (ret.intval)
+	if (psy->type != POWER_SUPPLY_TYPE_BATTERY)
+		if (!psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &ret))
 			return ret.intval;
-	}
+
 	return 0;
 }