Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: ti-st: st_kim: 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@sang-engineering.com>
Link: https://lore.kernel.org/r/20240604212240.4529-5-wsa+renesas@sang-engineering.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wolfram Sang and committed by
Greg Kroah-Hartman
d97fb257 4c0fb1af

+4 -4
+4 -4
drivers/misc/ti-st/st_kim.c
··· 198 198 { 199 199 unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0; 200 200 static const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 }; 201 - long timeout; 201 + long time_left; 202 202 203 203 pr_debug("%s", __func__); 204 204 ··· 208 208 return -EIO; 209 209 } 210 210 211 - timeout = wait_for_completion_interruptible_timeout( 211 + time_left = wait_for_completion_interruptible_timeout( 212 212 &kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME)); 213 - if (timeout <= 0) { 213 + if (time_left <= 0) { 214 214 pr_err(" waiting for ver info- timed out or received signal"); 215 - return timeout ? -ERESTARTSYS : -ETIMEDOUT; 215 + return time_left ? -ERESTARTSYS : -ETIMEDOUT; 216 216 } 217 217 reinit_completion(&kim_gdata->kim_rcvd); 218 218 /*