From patchwork Wed Sep 26 12:51:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10615911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CEA3174A for ; Wed, 26 Sep 2018 12:52:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E1AA2ADDD for ; Wed, 26 Sep 2018 12:52:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C7432AE25; Wed, 26 Sep 2018 12:52:14 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 A1EC02ADD9 for ; Wed, 26 Sep 2018 12:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727987AbeIZTE6 (ORCPT ); Wed, 26 Sep 2018 15:04:58 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:43583 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726937AbeIZTE5 (ORCPT ); Wed, 26 Sep 2018 15:04:57 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mdvua-1fWMy40ave-00b02Y; Wed, 26 Sep 2018 14:51:30 +0200 From: Arnd Bergmann To: Sakari Ailus , Mauro Carvalho Chehab Cc: Arnd Bergmann , Akinobu Mita , Sylwester Nawrocki , Hans Verkuil , Wolfram Sang , "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: ov9650: avoid maybe-uninitialized warnings Date: Wed, 26 Sep 2018 14:51:01 +0200 Message-Id: <20180926125127.2004280-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:aLqyWE4YSlZkupiUvPcnPMTz/l40VGp1bYyX96fDLKFfNcZn0sS WW8JuQFNIN2/KI5itgmpB3fAmklX/iSN+4hV/mBEq6yxdVNoljdqRtiylX9RmRYTOAWMGGG Qu9tdNbUCuob+3WT3LpK3yBf3UVsyGfWw1ZD63dpkyvI/47PHdi2adlkBWkezmtnwaSz21Z YSjaRRqyb9tpEj3p0uJjg== X-UI-Out-Filterresults: notjunk:1;V01:K0:SsXn2tsSk28=:mYsXTNi2a7Gu1jieleh0fW eS5jYty7KcpEBXqjVIGsTJOXe7xM89qsEkQsbwIf2sYw427TN0p0LdnGMQANHj4f8qlSNrAkN omGKSiray6n/NIsZ8rB+dBfiQUGAaXOCbRBJrIE08Wo4FV1vPPJSgCqKXyuFM52V1pIvS6xh5 3cuY/38C3D56AQHBlRTi5FiTW1/bLs2SYuz8h+qyZEngIuqLBFF2jBrnv87aeKCkLX3uI5aR0 i4KrJl5j/nEMtini/jQKYSB0HA/Ny8S9Mq/xgVh1UDITo8f2qG1SgyYY77OaDEPrXHR7hFC65 dp4pMjbWTcgxrLA7jJazwFTGcNjrWD+YXXZwBXU2gHioH13/Jryp08FTRpmVs1zEGzwW1k0c+ P5RpxW/HYdY64EtCexjokPoVaUCtqj3iTLe6vlZNqpEJH02sKSTBLxmrLxZ3P86FZn8W49tGI QxzZPBjCjxBFBMXF8dmyx7E8dxcsRRauYZKvMCuKSrShkVZXRZimwxSDy+vg97j85l8eWA3PQ 8lD0kscwzAQP+8bjry5e7jPodXMzB9gSmrKs3PMQiCm12bcbkXOpSocbCMvS707ez4ywBc3m8 8Eso1TumNIbqcvViEDxA0bJg2oLEdbfTwIMNEIs+HAGw1H6QMAEE8UzKl3CPUXSrOmo0DEHKt wRaou4n2v2EJ2TovB46wjfJNjFofqV7r5I/tvbp75rjfxLuWK82j/+JylVWKSR/XkLcY= 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 regmap change causes multiple warnings like drivers/media/i2c/ov9650.c: In function 'ov965x_g_volatile_ctrl': drivers/media/i2c/ov9650.c:889:29: error: 'reg2' may be used uninitialized in this function [-Werror=maybe-uninitialized] exposure = ((reg2 & 0x3f) << 10) | (reg1 << 2) | ~~~~~~~~~~~~~~~^~~~~~ It is apparently hard for the compiler to see here if ov965x_read() returned successfully or not. Besides, we have a v4l2_dbg() statement that prints an uninitialized value if regmap_read() fails. Adding an 'else' clause avoids the ambiguity. Fixes: 361f3803adfe ("media: ov9650: use SCCB regmap") Signed-off-by: Arnd Bergmann Reviewed-by: Akinobu Mita --- drivers/media/i2c/ov9650.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c index 3c9e6798d14b..77944da31de1 100644 --- a/drivers/media/i2c/ov9650.c +++ b/drivers/media/i2c/ov9650.c @@ -433,6 +433,8 @@ static int ov965x_read(struct ov965x *ov965x, u8 addr, u8 *val) ret = regmap_read(ov965x->regmap, addr, &buf); if (!ret) *val = buf; + else + *val = -1; v4l2_dbg(2, debug, &ov965x->sd, "%s: 0x%02x @ 0x%02x. (%d)\n", __func__, *val, addr, ret);