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: <28dda97db73c56fbaf746aa52eb63faaf02b15d7.camel@analog.com>
Date:   Wed, 14 Aug 2019 06:56:18 +0000
From:   "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To:     "Popa, Stefan Serban" <StefanSerban.Popa@...log.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "jic23@...nel.org" <jic23@...nel.org>,
        "knaack.h@....de" <knaack.h@....de>,
        "Hennerich, Michael" <Michael.Hennerich@...log.com>,
        "lars@...afoo.de" <lars@...afoo.de>,
        "rodrigorsdc@...il.com" <rodrigorsdc@...il.com>,
        "pmeerw@...erw.net" <pmeerw@...erw.net>
CC:     "kernel-usp@...glegroups.com" <kernel-usp@...glegroups.com>,
        "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>
Subject: Re: [PATCH v2] staging: iio: accel: adis16240: Improve readability
 on write_raw function

On Tue, 2019-08-13 at 16:31 -0300, Rodrigo Ribeiro wrote:
> [External]
> 
> Replace shift and minus operation by GENMASK macro and remove the local
> variables used to store intermediate data.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@...log.com>

> Signed-off-by: Rodrigo Ribeiro Carvalho <rodrigorsdc@...il.com>
> ---
> v2:
>    - Leave switch statement instead of replace by if statement
>  drivers/staging/iio/accel/adis16240.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/accel/adis16240.c b/drivers/staging/iio/accel/adis16240.c
> index 62f4b3b1b457..82099db4bf0c 100644
> --- a/drivers/staging/iio/accel/adis16240.c
> +++ b/drivers/staging/iio/accel/adis16240.c
> @@ -309,15 +309,12 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
>  			       long mask)
>  {
>  	struct adis *st = iio_priv(indio_dev);
> -	int bits = 10;
> -	s16 val16;
>  	u8 addr;
>  
>  	switch (mask) {
>  	case IIO_CHAN_INFO_CALIBBIAS:
> -		val16 = val & ((1 << bits) - 1);
>  		addr = adis16240_addresses[chan->scan_index][0];
> -		return adis_write_reg_16(st, addr, val16);
> +		return adis_write_reg_16(st, addr, val & GENMASK(9, 0));
>  	}
>  	return -EINVAL;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ