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: Sat, 4 May 2024 12:34:43 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Jorge Harrisonn <jorge.harrisonn@....br>
Cc: lars@...afoo.de, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org, laisnuto@....br
Subject: Re: [PATCH 1/2] iio: adc: ad7606: using claim_direct_scoped for
 code simplification

On Wed,  1 May 2024 18:57:23 -0300
Jorge Harrisonn <jorge.harrisonn@....br> wrote:

> Using iio_device_claim_direct_scoped instead of calling `iio_device
> _claim_direct_modeand later callingiio_device_release_direct_mode`
> 
> This should make code cleaner and error handling easier
> 
> Co-authored-by: Lais Nuto <laisnuto@....br>
> Signed-off-by: Lais Nuto <laisnuto@....br>
> Signed-off-by: Jorge Harrisonn <jorge.harrisonn@....br>
> ---
>  drivers/iio/adc/ad7606.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index 1928d9ae5bcf..fa989e0d7e70 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -174,17 +174,14 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
>  
>  	switch (m) {
>  	case IIO_CHAN_INFO_RAW:
> -		ret = iio_device_claim_direct_mode(indio_dev);
> -		if (ret)
> -			return ret;
> -
> -		ret = ad7606_scan_direct(indio_dev, chan->address);
> -		iio_device_release_direct_mode(indio_dev);
> -
> -		if (ret < 0)
> -			return ret;
> -		*val = (short)ret;
> -		return IIO_VAL_INT;
> +		iio_device_claim_direct_scoped(return -EBUSY, indio_dev) {
> +			ret = ad7606_scan_direct(indio_dev, chan->address);
> +			if (ret < 0) 

There is a stray space on the line above after the )

Make sure to run checkpatch.pl which should have caught this

> +				return ret;
> +			*val = (short) ret;

Not really part of your patch so I'll leave it alone, but that cast seems rather
pointless.

Applied to the togreg branch of iio.git and pushed out as testing with the
white space above fixed.   Note I'll be rebasing that tree after the
merge window so until then this will only be visible on the testing
branch.

Thanks,

Jonathan

> +			return IIO_VAL_INT;
> +		}
> +		unreachable();
>  	case IIO_CHAN_INFO_SCALE:
>  		if (st->sw_mode_en)
>  			ch = chan->address;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ