Skip to content

Commit

Permalink
power-supply: Drop useless 'if (ret.intval)' statements
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
  • Loading branch information
Viresh Kumar authored and Sebastian Reichel committed Sep 16, 2014
1 parent 585b008 commit 1c42a38
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions drivers/power/power_supply_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 1c42a38

Please sign in to comment.