提交 ea6a69de 编写于 作者: A Arnd Bergmann 提交者: Mauro Carvalho Chehab

[media] rainshadow-cec: avoid -Wmaybe-uninitialized warning

The barrier implied by spin_unlock() in rain_irq_work_handler makes it hard
for gcc to figure out the state of the variables, leading to 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]

Slightly rearranging the code makes it easier for the compiler to see that the
code is correct, and gets rid of the warning.

Fixes: 0f314f6c ("[media] rainshadow-cec: new RainShadow Tech HDMI CEC driver")
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 5c621744
......@@ -123,11 +123,12 @@ static void rain_irq_work_handler(struct work_struct *work)
char data;
spin_lock_irqsave(&rain->buf_lock, flags);
exit_loop = rain->buf_len == 0;
if (rain->buf_len) {
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册