Skip to content

Commit

Permalink
power_supply: Don't iterate over devices to return -EPROBE_DEFER
Browse files Browse the repository at this point in the history
This piece of code was added so that we return -EPROBE_DEFER when no devices are
registered. But even if class_for_each_device() returns 0, we are going to
return -EPROBE_DEFER only.

And so this code isn't required at all. Remove it.

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 464069c commit 7195c50
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions drivers/power/power_supply_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,6 @@ static int __power_supply_find_supply_from_node(struct device *dev,
static int power_supply_find_supply_from_node(struct device_node *supply_node)
{
int error;
struct device *dev;
struct class_dev_iter iter;

/*
* Use iterator to see if any other device is registered.
* This is required since class_for_each_device returns 0
* if there are no devices registered.
*/
class_dev_iter_init(&iter, power_supply_class, NULL, NULL);
dev = class_dev_iter_next(&iter);

if (!dev)
return -EPROBE_DEFER;

/*
* class_for_each_device() either returns its own errors or values
Expand Down

0 comments on commit 7195c50

Please sign in to comment.