From patchwork Fri Apr 21 10:51:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9692445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EAAD66037F for ; Fri, 21 Apr 2017 10:51:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7BAA1FF15 for ; Fri, 21 Apr 2017 10:51:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB2712860E; Fri, 21 Apr 2017 10:51:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 850991FF15 for ; Fri, 21 Apr 2017 10:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1038132AbdDUKvj (ORCPT ); Fri, 21 Apr 2017 06:51:39 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:62924 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1038039AbdDUKvi (ORCPT ); Fri, 21 Apr 2017 06:51:38 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0M3wNK-1cB4GO31Fq-00rav1; Fri, 21 Apr 2017 12:51:30 +0200 From: Arnd Bergmann To: Hans Verkuil , Mauro Carvalho Chehab Cc: Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] rainshadow-cec: avoid -Wmaybe-uninitialized warning Date: Fri, 21 Apr 2017 12:51:21 +0200 Message-Id: <20170421105139.875425-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:hQZrpXdCbJwz0huGt+RqDMaUlq9qhlXvzAyAxiHuUFaAJvwYbTn t+ZzfsCAFjs7m48Oy1/hzLBywjtLtTCFQvW3BfeYKUEZwA1QnWh+KCocPoQqoOk0uk1/Dj9 PN5iNgpbJkncsRhMWmrh00rF9lP1ykyBpBRpwikl89OlO2/U9Zz8tzpAQzjsmmtkGC8eA7N N8NenBGeNruEblrjbxujg== X-UI-Out-Filterresults: notjunk:1; V01:K0:bFj3Nz3Qqeg=:7wuepXvUEgvSGG9O2Bp0ZH J/c7sDcTZPhZpOCRtGlB5P/jL2QO1Y9uBtPN22nLCd3B+9x6VjWxoewwn8hvbTeOYiA+AV2nD k7SuGdYyIVVIA/WnrqHXaG52SPdf8+yTL6TzFVgNQUFsDx7phrE8KmUcvbfJ5vEpS0k7Kzw5i 78/lmc83kpOGzD0VybPTrLbFIJd1jDCw7zZEKOxbxjNfLLkU/P+TkUZWtOnkZEFqQNdB8zaQW Ubd8SwtLZx/Z54JdxjzB+YfzQm8rMU2Ei7vcofDs2HdtuNSmwcqvRIDst7f4GgGd2VUXuGS8j OY6rqLd1x/mMyY19NkLxzDsrFJuq6XfaVJ2QxTp2p3DVsAoXNncXLo+uzAPGaiMmxusNEPyNX EvJM076ntdibUpIZpNF+2ewu+LFE2AdVNzHGe8D6lhmZLVjTMdO4TF/5ihwAVI24VikTDrbeO 0Y/fEMPDH2gO2ntg+B68aRaZLPBXUhmBWscP5n+Nr1x61QaLlhzx4l7gBpLQxiDRLkLR/VtMH NA0gQx4b3BEGKvWlIczYD4+CuejcUTatL43/IiXt83Uok/ZR3RIKadErFRFPtBVROUaUGZXbw O4Wnd4kRVX5vmiuermyVG3de+vNeSUWBK8Zbpl4aDZlRDpGpuiAHw3NEh+QJZGSKrtRnK3s0R 71xov9o/ncq8rn9no8DW6qKhyE/aaryWHZiTJ85kcZTf+GqXP2UoNXtP7kKfbJPFBBwY= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);