From patchwork Sat Sep 23 19:45:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9967623 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 CD49B604D3 for ; Sat, 23 Sep 2017 19:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B92712915A for ; Sat, 23 Sep 2017 19:46:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE1F82918E; Sat, 23 Sep 2017 19:46:24 +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=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 B03802915A for ; Sat, 23 Sep 2017 19:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbdIWTp1 (ORCPT ); Sat, 23 Sep 2017 15:45:27 -0400 Received: from mout.web.de ([212.227.15.4]:63125 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751382AbdIWTp0 (ORCPT ); Sat, 23 Sep 2017 15:45:26 -0400 Received: from [192.168.1.2] ([77.181.226.196]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MDPYb-1eAMQu03sT-00Gqus; Sat, 23 Sep 2017 21:45:21 +0200 Subject: [PATCH 2/3] [media] camss-csid: Reduce the scope for a variable in csid_set_power() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Todor Tomov Cc: LKML , kernel-janitors@vger.kernel.org References: <168ff884-7ace-c548-7f90-d4f2910bb337@users.sourceforge.net> Message-ID: <8c356ba6-62a3-033d-f3d6-75e1bab1814f@users.sourceforge.net> Date: Sat, 23 Sep 2017 21:45:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <168ff884-7ace-c548-7f90-d4f2910bb337@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:Cq9PVq4xapm24MBph8Je9UBlev7QOAvLN0Ltokmo72Jafqk+L1j m7sw2YvCaeegI9FEMKDYKeUW7d5RKO554Xy/LwNcJJ/MVtvpJuAwj33Il9XEgfpTE39M93V zI0cMIfg6jPlV21cqTTwxTww2PbXprF6Yf17IHlfAt31/fbOKMrNRas8F3Pm75im0Fx5RKr D7+Czcow6Xv6LdVlJ8HCg== X-UI-Out-Filterresults: notjunk:1; V01:K0:jVl0KFdFiCI=:UvA83puRM+qEOTowrNxl8m kKRqWJqOg5pnPM8Ru+UpVuDt5unOovcxavRCLHM7V8Ag79sx8UsYx6XV3++2lDAq8PRjKHeT8 K8+6CfMDMTiKU0WVM8fxn5K/SHtPmiU5DPhLKi7useAVdni0zKGpHBu6tRx4rKYOxNdNjWMYO RdqO6XPujL+mGY7AxLFv7ek2vpuYa2sgDUGRVFQfUHp5yV2OIAMHQlHlY0P7TrEneMyn+M/PF 6gPvWNQFCl6LXR2KaXu+tI77fQycmOrKjN3X4xL223q1+XmzugOeT2OWWcaNJofD4VO2IbW5D RgNRhWXrERCBdYU7rDg3nJwkeYJZ+PCsV59veFCtxhOYTaw9S8aoMcD+K4NDALQL/rW3Wj2j+ 13QQzo78CSg6xtIecWR34+Xa9lRWGomknsYGs7TyEfeqbYa0mLs84AgeCRwNjVjna5nDBT/br JxfaYKOZ4kWXJUdEwjfvkDsZHRDo6Uw3qPmIQeg4awmfxEBzgcZgRFLE670K3pPs4OoC31ddl sF91c6V2RAX+/R0m+KcZLh4AyU1nhrrdFXtwXIbaOET+reb7rfwzAnD8xCuW9vDhog1beqNsj L4UkwSLXjbBVtm6+LeaYWTa8y2MHDUsUnV6AHriFB/QiWaJ93JfW3sihGGnxXDdxY7uKyP+8P 7j11VPnEPRH49q0ZW4tQJ2qAlAgHFGuGQSU4Y6jVAqS+Nbp4ZRP4oMoKoF1uVT53jfWoQ4/PG WPqA3U/fkp++BqTTcYSwIRTEB/bTW1wx4rm6h99XCq5qPxbAUzaauSd6Z4AK93eSnZCqlUANK A6VJu47jE1d9W0ZA48u29+vbyFd7A2plRSaa0lfx0qFzM36rzY= 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 From: Markus Elfring Date: Sat, 23 Sep 2017 21:00:30 +0200 Move the definition for the local variable "dev" into an if branch so that the corresponding setting will only be performed if it was selected by the parameter "on" of this function. Signed-off-by: Markus Elfring --- drivers/media/platform/qcom/camss-8x16/camss-csid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss-8x16/camss-csid.c b/drivers/media/platform/qcom/camss-8x16/camss-csid.c index 92d4dc6b4a66..ffda0fbfe4d8 100644 --- a/drivers/media/platform/qcom/camss-8x16/camss-csid.c +++ b/drivers/media/platform/qcom/camss-8x16/camss-csid.c @@ -317,10 +317,10 @@ static int csid_reset(struct csid_device *csid) static int csid_set_power(struct v4l2_subdev *sd, int on) { struct csid_device *csid = v4l2_get_subdevdata(sd); - struct device *dev = to_device_index(csid, csid->id); int ret; if (on) { + struct device *dev = to_device_index(csid, csid->id); u32 hw_version; ret = regulator_enable(csid->vdda);