From patchwork Wed Nov 10 10:59:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12611827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69B53C433F5 for ; Wed, 10 Nov 2021 10:59:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52B1861078 for ; Wed, 10 Nov 2021 10:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231360AbhKJLCA (ORCPT ); Wed, 10 Nov 2021 06:02:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:38748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231248AbhKJLB7 (ORCPT ); Wed, 10 Nov 2021 06:01:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 55276611BF; Wed, 10 Nov 2021 10:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636541952; bh=5TIG1BRWAdpzcni9lSwygVrJFoLLUWjoMyvM0Rtg+Ro=; h=From:To:Cc:Subject:Date:From; b=WsAyqdyKsc1yI/6YFYo2V/W7+NfjKeqsU3tQudqBOKv4ExGPL1Riz57Xee5R+g/lB vu/D3/3884Wsr/KY0m2o2/kTmHFZS2TIcEzeot0R+LW4aqjAay5I5j5rnleALgouCS 6w+2fxyFx8Dsu/nk0kvdBHXoLhkKIve/n1cgPJErRwO3yrchQg6eTiaxMIPbJT/MoH e+tQ32PxVScuB7rdsTi0a/jJED5LgLVjoWfUkLYV1vERNwrHrgrVCpgoY6QKhrk5jV Gsvpt1XIz44LQ+5P1PUN/CfyO00N6LzqA+6rQyV3S90PUQ5m7HtPCsUpCd2lJbPccv OBM7rznI6CNaw== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mklJt-002rxD-8E; Wed, 10 Nov 2021 10:59:09 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Deepak R Varma , Greg Kroah-Hartman , Hans Verkuil , Hans de Goede , Mauro Carvalho Chehab , Sakari Ailus , Tomi Valkeinen , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, Hans Verkuil Subject: [PATCH 1/2] media: atomisp-ov2680: initialize return var Date: Wed, 10 Nov 2021 10:59:07 +0000 Message-Id: <46ec939d911fc94b8a5e217874655e60512ad773.1636541941.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As the settings are only applied when the device is powered on, it should return 0 when the device is not powered. Not doing that causes a warning: drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function 'ov2680_ioctl': drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:390:16: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] 390 | return ov2680_set_exposure(sd, coarse_itg, analog_gain, digital_gain); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:359:13: note: 'ret' was declared here 359 | int ret; | ^~~ Reported-by: Hans Verkuil Cc: Hans de Goede Fixes: 6b5b60687ada ("media: atomisp-ov2680: Save/restore exposure and gain over sensor power-down") Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Hans de Goede --- drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 34d008236bd9..497884d332e1 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -356,7 +356,7 @@ static int ov2680_set_exposure(struct v4l2_subdev *sd, int exposure, int gain, int digitgain) { struct ov2680_device *dev = to_ov2680_sensor(sd); - int ret; + int ret = 0; mutex_lock(&dev->input_lock); From patchwork Wed Nov 10 10:59:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12611829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE7EDC433EF for ; Wed, 10 Nov 2021 10:59:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4B2D61078 for ; Wed, 10 Nov 2021 10:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231373AbhKJLCA (ORCPT ); Wed, 10 Nov 2021 06:02:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:38760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbhKJLB7 (ORCPT ); Wed, 10 Nov 2021 06:01:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59A4061205; Wed, 10 Nov 2021 10:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636541952; bh=lrO+JY2QDNzmXXL3NwoO4JWc7UMB3ftP9XCOGAxG6Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggSMzIbB/yz1AWLoILW3lJ7p+JCvoN2xJmnfaX7rvGHp43H0DszcoOr0lIb6EZTtx ndi/nHK25x5lyoBwCEjd2DgdRKYSme3901q3CYujZcq9K/E0byynw8iFiA0DnI7wHD 5xzOLKGDy5ClimLt8ivFanE0mOuGOk/HzyzFvxuNVC96o0UIuvdC4X/5xll0gbLe65 IDrSb3JVhhxltMlcibNkgQ7sOgpCEpY3X3UQ8PA8vlcv0s8z2ELAFy3jK68whppOJ5 KUqTvUYsTgb/WAGGIQofK826pe2nSQaZbIpGUy03suxFbQQUj2Q4nxvZkxuJi2FKZj qvYMAyqND0zFw== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mklJt-002rxG-8u; Wed, 10 Nov 2021 10:59:09 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Deepak R Varma , Greg Kroah-Hartman , Hans Verkuil , Hans de Goede , Mauro Carvalho Chehab , Sakari Ailus , Tomi Valkeinen , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, Hans Verkuil Subject: [PATCH 2/2] media: atomisp-ov2680: properly set the vts value Date: Wed, 10 Nov 2021 10:59:08 +0000 Message-Id: <4bada6cb5cb0d70d736ecb93f9c6dc2719d4241c.1636541941.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <46ec939d911fc94b8a5e217874655e60512ad773.1636541941.git.mchehab+huawei@kernel.org> References: <46ec939d911fc94b8a5e217874655e60512ad773.1636541941.git.mchehab+huawei@kernel.org> MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The vts value should be set before being checked, as otherwise a warning will arise: drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function 'ov2680_set_fmt': drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:873:33: warning: 'vts' may be used uninitialized [-Wmaybe-uninitialized] 873 | if (dev->exposure > vts - OV2680_INTEGRATION_TIME_MARGIN) Reported-by: Hans Verkuil Cc: Hans de Goede Fixes: 62b984359b6f ("media: atomisp-ov2680: Fix ov2680_set_fmt() messing up high exposure settings") Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 497884d332e1..d24f8830fd94 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -869,11 +869,11 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, dev_err(&client->dev, "ov2680 write resolution register err: %d\n", ret); + vts = dev->res->lines_per_frame; + /* If necessary increase the VTS to match exposure + MARGIN */ if (dev->exposure > vts - OV2680_INTEGRATION_TIME_MARGIN) vts = dev->exposure + OV2680_INTEGRATION_TIME_MARGIN; - else - vts = dev->res->lines_per_frame; ret = ov2680_write_reg(client, 2, OV2680_TIMING_VTS_H, vts); if (ret)