diff options
author | Sean Young <sean@mess.org> | 2020-04-22 22:16:46 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-04-29 12:59:57 +0300 |
commit | b7ba9f34800aee62e1ffcd4386a421116e09f4fe (patch) | |
tree | 03e157f6d2e9c69f5fe99e435ced7cc2e78c4a0d /drivers/media/tuners/si2157.c | |
parent | 408d0244421c1e76e9910b10d4f82f086b9751b3 (diff) | |
download | linux-b7ba9f34800aee62e1ffcd4386a421116e09f4fe.tar.xz |
media: si2157: ensure wait_status is initialized
smatch reports wait_status is uninitialized, because smatch cannot assume
the loop body is ever executed.
Clarify the code so that wait_status is retrieved at least once.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/tuners/si2157.c')
-rw-r--r-- | drivers/media/tuners/si2157.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index 6b452565dedb..fefb2625f655 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -327,7 +327,7 @@ static int si2157_tune_wait(struct i2c_client *client, u8 is_digital) /* wait tuner command complete */ start_time = jiffies; timeout = start_time + msecs_to_jiffies(TUN_TIMEOUT); - while (!time_after(jiffies, timeout)) { + while (1) { ret = i2c_master_recv(client, &wait_status, sizeof(wait_status)); if (ret < 0) { @@ -337,6 +337,9 @@ static int si2157_tune_wait(struct i2c_client *client, u8 is_digital) goto err_mutex_unlock; } + if (time_after(jiffies, timeout)) + break; + /* tuner done? */ if ((wait_status & 0x81) == 0x81) break; |