Skip to content

Commit c386e07

Browse files
Hans Verkuilmchehab
authored andcommitted
media: dvb-frontends/drxk_hard.c: fix uninitialized variable warning
drxk_hard.c: In function 'hi_command.constprop': drxk_hard.c:1016:5: warning: 'wait_cmd' may be used uninitialized in this function [-Wmaybe-uninitialized] 1015 | } while ((status < 0) && (retry_count < DRXK_MAX_RETRIES) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1016 | && (wait_cmd != 0)); | ^~~~~~~~~~~~~~~~~~ The underlying cause is that the while condition is wrong. It should be: (status < 0 || wait_cmd) && (retry_count < DRXK_MAX_RETRIES) 'wait_cmd' is only valid if '!(status < 0)'. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 2311072 commit c386e07

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/media/dvb-frontends/drxk_hard.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,7 @@ static int hi_command(struct drxk_state *state, u16 cmd, u16 *p_result)
10111011
retry_count += 1;
10121012
status = read16(state, SIO_HI_RA_RAM_CMD__A,
10131013
&wait_cmd);
1014-
} while ((status < 0) && (retry_count < DRXK_MAX_RETRIES)
1015-
&& (wait_cmd != 0));
1014+
} while ((status < 0 || wait_cmd) && (retry_count < DRXK_MAX_RETRIES));
10161015
if (status < 0)
10171016
goto error;
10181017
status = read16(state, SIO_HI_RA_RAM_RES__A, p_result);

0 commit comments

Comments
 (0)