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]
Date:	Mon, 14 May 2012 10:19:18 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Chanwoo Choi <cw00.choi@...sung.com>
Cc:	sameo@...ux.intel.com, myungjoo.ham@...sung.com,
	kyungmin.park@...sung.com, jonghwa3.lee@...sung.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] MFD: MAX77693: add MAX77693 MFD driver

On Mon, May 14, 2012 at 02:20:30PM +0900, Chanwoo Choi wrote:

> Signef-off-by: Chanwoo Choi <cw00.choi@...sung.com>

Typo :)

> +int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest)
> +{
> +	unsigned int val;
> +	int ret;
> +
> +	ret = regmap_read(map, reg, &val);
> +	val &= 0xff;
> +	*dest = val;

Should be no need for the val &= 0xff - if there is there's a bug we
ought to fix in regmap.

> +int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask)
> +{
> +	unsigned int old_val, new_val;
> +	int ret;
> +
> +	ret = regmap_read(map, reg, &old_val);
> +	old_val &= 0xff;
> +	new_val = (val & mask) | (old_val & (~mask));
> +	ret = regmap_write(map, reg, new_val);

This should be using regmap_update_bits(), the current code is buggy as
it does not lock which means that multiple simultaneous updaters could
conflict with each other.

> +static struct regmap_config max77693_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,

Defining max_register would let you see the register map in debugfs but
this is optional.

> +	max77693->regmap = regmap_init_i2c(i2c, &max77693_regmap_config);
> +	if (IS_ERR(max77693->regmap)) {

devm_regmap_init_i2c().

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ