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, 30 Apr 2024 01:36:14 +0000
From: Peng Fan <peng.fan@....com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
	"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>
CC: Jonathan Cameron <jic23@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
	Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>, Fabio Estevam
	<festevam@...il.com>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/8] iio: adc: fsl-imx25-gcq: use 'time_left' variable
 with wait_for_completion_interruptible_timeout()

> Subject: [PATCH 3/8] iio: adc: fsl-imx25-gcq: use 'time_left' variable with
> wait_for_completion_interruptible_timeout()
> 
> There is a confusing pattern in the kernel to use a variable named 'timeout' to
> store the result of wait_for_completion_interruptible_timeout() causing
> patterns like:
> 
> 	timeout = wait_for_completion_interruptible_timeout(...)
> 	if (!timeout) return -ETIMEDOUT;
> 
> with all kinds of permutations. Use 'time_left' as a variable to make the code
> self explaining.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@...g-engineering.com>

Reviewed-by: Peng Fan <peng.fan@....com>
> ---
>  drivers/iio/adc/fsl-imx25-gcq.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c
> index 68c813de0605..dabc5303d644 100644
> --- a/drivers/iio/adc/fsl-imx25-gcq.c
> +++ b/drivers/iio/adc/fsl-imx25-gcq.c
> @@ -107,7 +107,7 @@ static int mx25_gcq_get_raw_value(struct device
> *dev,
>  				  struct mx25_gcq_priv *priv,
>  				  int *val)
>  {
> -	long timeout;
> +	long time_left;
>  	u32 data;
> 
>  	/* Setup the configuration we want to use */ @@ -120,12 +120,12
> @@ static int mx25_gcq_get_raw_value(struct device *dev,
>  	regmap_update_bits(priv->regs, MX25_ADCQ_CR,
> MX25_ADCQ_CR_FQS,
>  			   MX25_ADCQ_CR_FQS);
> 
> -	timeout = wait_for_completion_interruptible_timeout(
> +	time_left = wait_for_completion_interruptible_timeout(
>  		&priv->completed, MX25_GCQ_TIMEOUT);
> -	if (timeout < 0) {
> +	if (time_left < 0) {
>  		dev_err(dev, "ADC wait for measurement failed\n");
> -		return timeout;
> -	} else if (timeout == 0) {
> +		return time_left;
> +	} else if (time_left == 0) {
>  		dev_err(dev, "ADC timed out\n");
>  		return -ETIMEDOUT;
>  	}
> --
> 2.43.0
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ