lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <31e2a928-61f8-4706-9981-0d2e9ab2bc10@roeck-us.net>
Date:   Sun, 6 Aug 2017 07:31:09 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Hans de Goede <hdegoede@...hat.com>,
        Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>,
        Wolfram Sang <wsa@...-dreams.de>,
        Sebastian Reichel <sre@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-i2c@...r.kernel.org, Liam Breck <liam@...workimprov.net>,
        Tony Lindgren <tony@...mide.com>, linux-pm@...r.kernel.org,
        devel@...verdev.osuosl.org
Subject: Re: [PATCH 11/18] power: supply: Fix power_supply_am_i_supplied to
 return -ENODEV when apropriate

On 08/06/2017 05:35 AM, Hans de Goede wrote:
> Commit 2848e039c562 ("power: supply: Make power_supply_am_i_supplied return
> -ENODEV if there are no suppliers") was supposed to make
> power_supply_am_i_supplied() return -ENODEV when there are no supplies
> which supply the supply passed to it.
> 
> But instead it will only return -ENODEV when there are no supplies at
> all as data->count++; is incremented on every call of the iterator, rather
> then only when __power_supply_is_supplied_by returns true. This commit
> fixes this.
> 
> Fixes: 2848e039c562 ("power: supply: Make power_supply_am_i_supplied ...")
> Signed-off-by: Hans de Goede <hdegoede@...hat.com>

Independent of this series ?

> ---
>   drivers/power/supply/power_supply_core.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 540d3e0aa011..0741fcef3b44 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -314,11 +314,12 @@ static int __power_supply_am_i_supplied(struct device *dev, void *_data)
>   	struct power_supply *epsy = dev_get_drvdata(dev);
>   	struct psy_am_i_supplied_data *data = _data;
>   
> -	data->count++;
> -	if (__power_supply_is_supplied_by(epsy, data->psy))
> +	if (__power_supply_is_supplied_by(epsy, data->psy)) {
> +		data->count++;
>   		if (!epsy->desc->get_property(epsy, POWER_SUPPLY_PROP_ONLINE,
>   					&ret))
>   			return ret.intval;
> +	}
>   
>   	return 0;
>   }
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ