* [PATCH] [media] rainshadow-cec: avoid -Wmaybe-uninitialized warning
@ 2017-04-21 10:51 Arnd Bergmann
0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2017-04-21 10:51 UTC (permalink / raw)
To: Hans Verkuil, Mauro Carvalho Chehab
Cc: Arnd Bergmann, linux-media, linux-kernel
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: 0f314f6c2e77 ("[media] rainshadow-cec: new RainShadow Tech HDMI CEC driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
index dc1f64f904cd..9ddd6a99f066 100644
--- a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
+++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
@@ -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);
--
2.9.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-21 10:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21 10:51 [PATCH] [media] rainshadow-cec: avoid -Wmaybe-uninitialized warning Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®