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: <20101220123903.GE26706@rakim.wolfsonmicro.main>
Date:	Mon, 20 Dec 2010 12:39:03 +0000
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Saravana Kannan <skannan@...eaurora.org>
Cc:	Liam Girdwood <lrg@...mlogic.co.uk>, linux-arm-msm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regulator: Update consumer state only after set
 voltage succeeds.

On Fri, Dec 17, 2010 at 02:44:28PM -0800, Saravana Kannan wrote:

>  static int regulator_check_consumers(struct regulator_dev *rdev,
> +				     struct regulator *ignore,
>  				     int *min_uV, int *max_uV)

This feels really invasive, and prone to robustness issues as we're just
randomly not checking one of the consumers on a single call, meaning we
skip some checking some of the time.  It's not going to make the code
more maintainable.

> -	regulator->min_uV = min_uV;
> -	regulator->max_uV = max_uV;
> -
> -	ret = regulator_check_consumers(rdev, &min_uV, &max_uV);
> +	ret = regulator_check_consumers(rdev, regulator, &min_uV, &max_uV);
>  	if (ret < 0)
>  		goto out;
>  
>  	ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
> +	if (!ret) {
> +		regulator->min_uV = min_uV;
> +		regulator->max_uV = max_uV;
> +	}

If you're going to do something probably unwinding the assignment on
error would cover it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ