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: <20180722220211.qzlxawn63itxbjmc@earth.universe>
Date:   Mon, 23 Jul 2018 00:02:11 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.co.uk>
To:     David Lechner <david@...hnology.com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] power: supply: lego_ev3_battery: Don't ignore
 iio_read_channel_processed() return value

Hi,

On Fri, Jul 20, 2018 at 03:19:43PM -0500, David Lechner wrote:
> This changes the LEGO MINDSTORMS EV3 power supply driver to return an
> error if iio_read_channel_processed() fails.
> 
> Signed-off-by: David Lechner <david@...hnology.com>
> ---

Thanks, queued to power-supply's for-next branch.

-- Sebastian

>  drivers/power/supply/lego_ev3_battery.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/supply/lego_ev3_battery.c b/drivers/power/supply/lego_ev3_battery.c
> index 7b993d669f7f..6e3b3e384172 100644
> --- a/drivers/power/supply/lego_ev3_battery.c
> +++ b/drivers/power/supply/lego_ev3_battery.c
> @@ -39,7 +39,7 @@ static int lego_ev3_battery_get_property(struct power_supply *psy,
>  					 union power_supply_propval *val)
>  {
>  	struct lego_ev3_battery *batt = power_supply_get_drvdata(psy);
> -	int val2;
> +	int ret, val2;
>  
>  	switch (psp) {
>  	case POWER_SUPPLY_PROP_TECHNOLOGY:
> @@ -47,11 +47,18 @@ static int lego_ev3_battery_get_property(struct power_supply *psy,
>  		break;
>  	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
>  		/* battery voltage is iio channel * 2 + Vce of transistor */
> -		iio_read_channel_processed(batt->iio_v, &val->intval);
> +		ret = iio_read_channel_processed(batt->iio_v, &val->intval);
> +		if (ret)
> +			return ret;
> +
>  		val->intval *= 2000;
>  		val->intval += 200000;
> +
>  		/* plus adjust for shunt resistor drop */
> -		iio_read_channel_processed(batt->iio_i, &val2);
> +		ret = iio_read_channel_processed(batt->iio_i, &val2);
> +		if (ret)
> +			return ret;
> +
>  		val2 *= 1000;
>  		val2 /= 15;
>  		val->intval += val2;
> @@ -64,7 +71,10 @@ static int lego_ev3_battery_get_property(struct power_supply *psy,
>  		break;
>  	case POWER_SUPPLY_PROP_CURRENT_NOW:
>  		/* battery current is iio channel / 15 / 0.05 ohms */
> -		iio_read_channel_processed(batt->iio_i, &val->intval);
> +		ret = iio_read_channel_processed(batt->iio_i, &val->intval);
> +		if (ret)
> +			return ret;
> +
>  		val->intval *= 20000;
>  		val->intval /= 15;
>  		break;
> -- 
> 2.17.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ