• Viresh Kumar's avatar
    power-supply: Don't return -EINVAL from __power_supply_find_supply_from_node() · 585b0087
    Viresh Kumar authored
    We need to stop 'class_for_each_device' loop when a supply matches with the
    of-node. In order to achieve this we currently return -EINVAL from
    __power_supply_populate_supplied_from() on successful match.
    
    class_for_each_device() is free to return similar errors in other cases as well
    and so the choice of return value here isn't particularly great.
    
    This commit isn't removing the Hack but making it more elegant by returning '1'
    instead.
    
    Also power_supply_find_supply_from_node() can return errors other than
    -EPROBE_DEFER now if class_for_each_device() fails.
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
    585b0087
power_supply_core.c 15.6 KB