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] [day] [month] [year] [list]
Date:	Tue, 26 Jan 2016 16:52:49 +0000
From:	Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>
To:	Lucas Tanure <tanure@...ux.com>
CC:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	<linux-kernel@...r.kernel.org>,
	<patches@...nsource.wolfsonmicro.com>,
	Jaroslav Kysela <perex@...ex.cz>
Subject: Re: [PATCH] ASoC: wm2000: Use a signed return type for regmap_read

On Mon, Jan 25, 2016 at 05:48:13PM -0200, Lucas Tanure wrote:
> The return type "unsigned int" was used by the regmap_read() function despite
> of the aspect that it will eventually return a negative error code. So, change
> to signed int and get reg by reference in the parameters
> 
> Signed-off-by: Lucas Tanure <tanure@...ux.com>
> ---
>  sound/soc/codecs/wm2000.c | 25 +++++++++----------------
>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
> index a67ea10..990d710 100644
> --- a/sound/soc/codecs/wm2000.c
> +++ b/sound/soc/codecs/wm2000.c
> @@ -88,17 +88,11 @@ static int wm2000_write(struct i2c_client *i2c, unsigned int reg,
>  	return regmap_write(wm2000->regmap, reg, value);
>  }
>  
> -static unsigned int wm2000_read(struct i2c_client *i2c, unsigned int r)
> +static int wm2000_read(struct i2c_client *i2c, unsigned int reg,
> +			unsigned int *value)
>  {
>  	struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c);
> -	unsigned int val;
> -	int ret;
> -
> -	ret = regmap_read(wm2000->regmap, r, &val);
> -	if (ret < 0)
> -		return -1;
> -
> -	return val;
> +	return regmap_read(wm2000->regmap, reg, value);

At this point the wm2000_read function is not really adding
anything feels like we should just remove it and use regmap_read
directly.

Thanks,
Charles

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ