From patchwork Mon Feb 27 20:32:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9594135 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 176E260453 for ; Mon, 27 Feb 2017 20:36:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AE3C20453 for ; Mon, 27 Feb 2017 20:36:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3876223A6; Mon, 27 Feb 2017 20:36:02 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5F31A204BD for ; Mon, 27 Feb 2017 20:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751530AbdB0Ufr (ORCPT ); Mon, 27 Feb 2017 15:35:47 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:62829 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbdB0Ufp (ORCPT ); Mon, 27 Feb 2017 15:35:45 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0M2dm9-1cPxBn2RML-00sRTv; Mon, 27 Feb 2017 21:32:58 +0100 From: Arnd Bergmann To: Bluecherry Maintainers , Andrey Utkin , Mauro Carvalho Chehab Cc: Arnd Bergmann , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] tw5864: handle unknown video std gracefully Date: Mon, 27 Feb 2017 21:32:34 +0100 Message-Id: <20170227203252.3295528-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:twVWcxNkx3JJoFSWTEzOcx52Lt09ljDsKZU6k+m1vB3i6vRJmIH naHm52AHaeraKPdDdWUhiyqNuuzC4t6hCSj3aF7XN9JaHNf4bGPqWdQdh1tc7oWrcD3Z4Vj Tw1H1I2UmF9wwkNJGWZW/XO6mCRwbDOoPGXg0d3ZgbohSsUo0CXE42O+NR+gJjOMCq49DOc 9dlzjWRvzKQ9mlK8Ql72w== X-UI-Out-Filterresults: notjunk:1; V01:K0:MTMwKBE3+YU=:v3nwAVrRqAEqLXF5yfvGni kerQOl/rg6U9qrCBqjvSb4Nzc1uFfkAR2RAILf/gyvKlkZcqZQtayPFRUxOgg81hoUahetwsP cDQE1sjiW5ZjFJ3p+lYVum1U5vbOTGSDJ2YTX3IF4Rw5lwaWa2W+puGf1vFwf9UYCkL0AQStd D8WQenjT4sMLOfZB2aOeerISlgEr5RMGsmR5nNdQYiTvk5m69lx92M/tJBiQdMMWQ2CfeQYxV qoGnfb+usbwtlEF/eQt1NR84yOhZvbdiCcfpj3rDlPnrpcmTIRDfX+TwuiAGDgkvQVAei47y9 Wu0ecu+67d+Usgxe8GuY0oSg7TVi9nFpiVauC5fwomssNk7qGKpBLQ6YDzmoHaXJZTwbRoeZF U81QKsY250UBi0pEg1Jgw01BXd/e4iTVtLcsIndZklbxTZIH9Hb0Ue/pPTcXhJpUy3o0TT+Ru YiBtb8LPO/ZbUGsEaykIe5l3nH5UDQk6EGYqh5W3uTjRk5I2NtJfF0DpyqAMGALWb+iYJEeD3 28QWHbtKMn11y/J9TfD8I0/+ooaOstZ1fNkAUBodoEU0Y64HTOyBL+8jsS9ppFTVCS+5W6nvs zbSZbABAi11O1fgQaOb04Yf/O8486B+bWFM5HpYA4UiYzQ1Z8h2ycUP/nPndGVKhDSPW+DUGq mzNAXtrflCmTNsDPlHkkk2D7nTxc3iU3qf4M+HkEUjEhdglmeBJvXUwX5h0MXkMyaVfo= 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 tw5864_frameinterval_get() only initializes its output when it successfully identifies the video standard in tw5864_input. We get a warning here because gcc can't always track the state if initialized warnings across a WARN() macro, and thinks it might get used incorrectly in tw5864_s_parm: media/pci/tw5864/tw5864-video.c: In function 'tw5864_s_parm': media/pci/tw5864/tw5864-video.c:816:38: error: 'time_base.numerator' may be used uninitialized in this function [-Werror=maybe-uninitialized] media/pci/tw5864/tw5864-video.c:819:31: error: 'time_base.denominator' may be used uninitialized in this function [-Werror=maybe-uninitialized] This particular use happens to be ok, but we do copy the uninitialized output of tw5864_frameinterval_get() into other memory without checking the return code, interestingly without getting a warning here. This initializes the output to 1/1s for the case, to make sure we do get an intialization that doesn't cause a division-by-zero exception in case we end up using this uninitialized data later. This also avoids the warning. Signed-off-by: Arnd Bergmann --- drivers/media/pci/tw5864/tw5864-video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c index 9421216bb942..a451c2081fde 100644 --- a/drivers/media/pci/tw5864/tw5864-video.c +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -728,6 +728,8 @@ static int tw5864_frameinterval_get(struct tw5864_input *input, frameinterval->denominator = 25; break; default: + frameinterval->numerator = 1; + frameinterval->denominator = 1; WARN(1, "tw5864_frameinterval_get requested for unknown std %d\n", input->std); return -EINVAL;