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: 147576 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp683601lji; Wed, 26 Sep 2018 05:52:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV60451E9q/xJhOQ+laxRZK+4aUuPGTrn+PpjzR/ATi3cW5Am0v8dKUInk17/WHpB9fq1Xd99 X-Received: by 2002:a63:d806:: with SMTP id b6-v6mr5535782pgh.347.1537966329334; Wed, 26 Sep 2018 05:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537966329; cv=none; d=google.com; s=arc-20160816; b=ZnaODiLPr/CA5+0VzerpqaZ9AtBjrsElqHbx3qc+vlq3aalm9sUjyUICzfKRdM05cM g+sZptf3Xj1D7RLey1XP1JKvtPdjj0p1/kOzaUD1VJgDjn/a5rx0q/2gErBTOIZmBumL a7rrkD5EegGY6iGvlvW6oxuhj/EzOS4k3Ac0GRwLaQ5KHWJxFWCTxklItrZI8E95/Rjd iZ51qGidycQX83vieuggFmjsE8XOcrf1tKaHe0P4dVd6woTtQ2uG9fIXHFhOO85bFzFr kJZBUIY6m7uKsUfcfaPWEw/oWbv8M3WbhS+8JnhU3IcHkQ6OUojhFDdUdw2ISJ7khMM/ QeDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Pw9oO2HL+wHnljUaMZT/xHAUWAwF1sHREBL2gVv/OPY=; b=UGTxBiDN1sEsxqM6x8CkjFikJgK7Vr0KWwNT5R+ws402rN69A8dZmVTraf9ki+amy3 sdT0N019YIootlV643Jv960hr+2LzzByUw6WEcaob6LpKam7fc/3fqyocWzDtwIg9LeF 6dEX7g86pEfvmsJKuc4Iyt9t4Nt17ayakQ1gBPEx15xI0ldyf9SjYDTSSUL9Qt4danhq 5gqMzL81Y/1Z8W3HENedXYn+4heLrdXbdkrJ6p9CLirop6R8riLZg7s1RwdMJCrgYyZp nRKbKX61qxeFkYyikwwXJG2hd/0Arzt9DYTnHnlgngGHPdzXHEckA8i17H1BxVc8snKe 2vJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2-v6si4936201pfi.351.2018.09.26.05.52.09; Wed, 26 Sep 2018 05:52:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbeIZTE6 (ORCPT + 32 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/media/i2c/ov9650.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.18.0 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);