Commit 0a0c1b82 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mauro Carvalho Chehab

media: rainshadow-cec: avoid -Wmaybe-uninitialized warning again

Back in April I created a patch to address a false-positive warning:

drivers/media/usb/rainshadow-cec/rainshadow-cec.c: In function 'rain_irq_work_handler':
drivers/media/usb/rainshadow-cec/rainshadow-cec.c:171:31: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]

My patch was totally wrong and introduced a real bug, and Colin Ian King thankfully
noticed it now and fixed my mistake. Unfortunately, fixing the actual uninitialized
data in this case brought back the original bogus warning.

This is a new version of the patch, which simplifies the code to the point where
gcc notices the behavior is correct.

Fixes: ca33784b ("[media] rainshadow-cec: ensure exit_loop is intialized")
Fixes: ea6a69de ("[media] rainshadow-cec: avoid -Wmaybe-uninitialized warning")

Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7ee88f8c
......@@ -116,21 +116,19 @@ static void rain_irq_work_handler(struct work_struct *work)
while (true) {
unsigned long flags;
bool exit_loop = false;
char data;
spin_lock_irqsave(&rain->buf_lock, flags);
if (rain->buf_len) {
if (!rain->buf_len) {
spin_unlock_irqrestore(&rain->buf_lock, flags);
break;
}
data = rain->buf[rain->buf_rd_idx];
rain->buf_len--;
rain->buf_rd_idx = (rain->buf_rd_idx + 1) & 0xff;
} else {
exit_loop = true;
}
spin_unlock_irqrestore(&rain->buf_lock, flags);
if (exit_loop)
break;
spin_unlock_irqrestore(&rain->buf_lock, flags);
if (!rain->cmd_started && data != '?')
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment