mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
crypto: api - use 'time_left' variable with wait_for_completion_killable_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_killable_timeout() causing patterns like: timeout = wait_for_completion_killable_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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -202,18 +202,18 @@ static void crypto_start_test(struct crypto_larval *larval)
|
|||||||
static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
|
static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
|
||||||
{
|
{
|
||||||
struct crypto_larval *larval = (void *)alg;
|
struct crypto_larval *larval = (void *)alg;
|
||||||
long timeout;
|
long time_left;
|
||||||
|
|
||||||
if (!crypto_boot_test_finished())
|
if (!crypto_boot_test_finished())
|
||||||
crypto_start_test(larval);
|
crypto_start_test(larval);
|
||||||
|
|
||||||
timeout = wait_for_completion_killable_timeout(
|
time_left = wait_for_completion_killable_timeout(
|
||||||
&larval->completion, 60 * HZ);
|
&larval->completion, 60 * HZ);
|
||||||
|
|
||||||
alg = larval->adult;
|
alg = larval->adult;
|
||||||
if (timeout < 0)
|
if (time_left < 0)
|
||||||
alg = ERR_PTR(-EINTR);
|
alg = ERR_PTR(-EINTR);
|
||||||
else if (!timeout)
|
else if (!time_left)
|
||||||
alg = ERR_PTR(-ETIMEDOUT);
|
alg = ERR_PTR(-ETIMEDOUT);
|
||||||
else if (!alg)
|
else if (!alg)
|
||||||
alg = ERR_PTR(-ENOENT);
|
alg = ERR_PTR(-ENOENT);
|
||||||
|
|||||||
Reference in New Issue
Block a user