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: Sun, 28 Apr 2024 07:38:00 +0300
From: Baruch Siach <baruch@...s.co.il>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: linux-i2c@...r.kernel.org, Andi Shyti <andi.shyti@...nel.org>,
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/15] i2c: digicolor: use 'time_left' variable with
 wait_for_completion_timeout()

Hi Wolfram,

On Sat, Apr 27 2024, Wolfram Sang wrote:
> There is a confusing pattern in the kernel to use a variable named 'timeout' to
> store the result of wait_for_completion_timeout() causing patterns like:
>
> 	timeout = wait_for_completion_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>

Acked-by: Baruch Siach <baruch@...s.co.il>

Thanks,
baruch

> ---
>  drivers/i2c/busses/i2c-digicolor.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c
> index 3462f2bc0fa8..737604ae11fc 100644
> --- a/drivers/i2c/busses/i2c-digicolor.c
> +++ b/drivers/i2c/busses/i2c-digicolor.c
> @@ -213,7 +213,7 @@ static irqreturn_t dc_i2c_irq(int irq, void *dev_id)
>  static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first,
>  			   int last)
>  {
> -	unsigned long timeout = msecs_to_jiffies(TIMEOUT_MS);
> +	unsigned long time_left = msecs_to_jiffies(TIMEOUT_MS);
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&i2c->lock, flags);
> @@ -227,9 +227,9 @@ static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first,
>  	dc_i2c_start_msg(i2c, first);
>  	spin_unlock_irqrestore(&i2c->lock, flags);
>  
> -	timeout = wait_for_completion_timeout(&i2c->done, timeout);
> +	time_left = wait_for_completion_timeout(&i2c->done, time_left);
>  	dc_i2c_set_irq(i2c, 0);
> -	if (timeout == 0) {
> +	if (time_left == 0) {
>  		i2c->state = STATE_IDLE;
>  		return -ETIMEDOUT;
>  	}


-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@...s.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ