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]
Message-ID: <aHzwDHcmU23Er-35@debian-BULLSEYE-live-builder-AMD64>
Date: Sun, 20 Jul 2025 10:33:00 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Marcelo Schmitt <marcelo.schmitt@...log.com>, linux-iio@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>,
	Andy Shevchenko <andy@...nel.org>,
	Dan Carpenter <dan.carpenter@...aro.org>,
	David Lechner <dlechner@...libre.com>,
	Jonathan Cameron <jic23@...nel.org>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Nuno Sá <nuno.sa@...log.com>,
	Michael Hennerich <michael.hennerich@...log.com>
Subject: Re: [PATCH] iio: adc: ad4170-4: Correctly update filter_fs after
 filter type change

On 07/20, Markus Elfring wrote:
> …
> > +++ b/drivers/iio/adc/ad4170-4.c
> > @@ -880,10 +880,12 @@ static int ad4170_set_filter_type(struct iio_dev *indio_dev,
> >  			return -EBUSY;
> >  
> >  		if (val == AD4170_SINC5_AVG || val == AD4170_SINC3)
> > -			setup->filter_fs = clamp(val, AD4170_SINC3_MIN_FS,
> > +			setup->filter_fs = clamp(setup->filter_fs,
> > +						 AD4170_SINC3_MIN_FS,
> >  						 AD4170_SINC3_MAX_FS);
> >  		else
> > -			setup->filter_fs = clamp(val, AD4170_SINC5_MIN_FS,
> > +			setup->filter_fs = clamp(setup->filter_fs,
> > +						 AD4170_SINC5_MIN_FS,
> >  						 AD4170_SINC5_MAX_FS);
> >  
> >  		setup->filter &= ~AD4170_FILTER_FILTER_TYPE_MSK;
> 
> How do you think about to use the following code variant?
> 
> 		setup->filter_fs = (val == AD4170_SINC5_AVG || val == AD4170_SINC3)
> 				   ? clamp(setup->filter_fs,
> 					   AD4170_SINC3_MIN_FS, AD4170_SINC3_MAX_FS)
> 				   : clamp(setup->filter_fs,
> 					   AD4170_SINC5_MIN_FS, AD4170_SINC5_MAX_FS);
> 
Looks good to me.
I'll send v2 with that.

Thanks,
Marcelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ