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: <CAMj1kXHPqVN4XBaGuDvDV21LLxX=e17Csz_mix4NsykSx788Wg@mail.gmail.com>
Date: Mon, 29 Apr 2024 08:56:38 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: linux-i2c@...r.kernel.org, Andi Shyti <andi.shyti@...nel.org>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/15] i2c: synquacer: use 'time_left' variable with wait_for_completion_timeout()

On Sat, 27 Apr 2024 at 22:36, Wolfram Sang
<wsa+renesas@...g-engineering.com> 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: Ard Biesheuvel <ardb@...nel.org>

> ---
>  drivers/i2c/busses/i2c-synquacer.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
> index bbea521b05dd..bf9bcfefa30e 100644
> --- a/drivers/i2c/busses/i2c-synquacer.c
> +++ b/drivers/i2c/busses/i2c-synquacer.c
> @@ -311,7 +311,7 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i2c,
>                                 struct i2c_msg *msgs, int num)
>  {
>         unsigned char bsr;
> -       unsigned long timeout;
> +       unsigned long time_left;
>         int ret;
>
>         synquacer_i2c_hw_init(i2c);
> @@ -335,9 +335,9 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i2c,
>                 return ret;
>         }
>
> -       timeout = wait_for_completion_timeout(&i2c->completion,
> -                                       msecs_to_jiffies(i2c->timeout_ms));
> -       if (timeout == 0) {
> +       time_left = wait_for_completion_timeout(&i2c->completion,
> +                                               msecs_to_jiffies(i2c->timeout_ms));
> +       if (time_left == 0) {
>                 dev_dbg(i2c->dev, "timeout\n");
>                 return -EAGAIN;
>         }
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ