From patchwork Wed Oct 12 14:44:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9373315 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 33E8A60839 for ; Wed, 12 Oct 2016 14:45:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23D512963A for ; Wed, 12 Oct 2016 14:45:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16B1129644; Wed, 12 Oct 2016 14:45:16 +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 8E4C22963A for ; Wed, 12 Oct 2016 14:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932617AbcJLOpH (ORCPT ); Wed, 12 Oct 2016 10:45:07 -0400 Received: from mout.web.de ([212.227.15.3]:52925 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933630AbcJLOpC (ORCPT ); Wed, 12 Oct 2016 10:45:02 -0400 Received: from [192.168.1.2] ([78.49.9.22]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MXpqx-1bO8tm1ZrT-00WoJ9; Wed, 12 Oct 2016 16:44:53 +0200 Subject: [PATCH 09/34] [media] DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output() To: linux-media@vger.kernel.org, Hans Verkuil , "Lad, Prabhakar" , Mauro Carvalho Chehab References: Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <207ad99c-288a-0fca-677c-dcdc5334eb25@users.sourceforge.net> Date: Wed, 12 Oct 2016 16:44:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:91giBKRiCNnFKkuRnyfcNBkSkQQMluZ6YZuL/u+R9BLDfoUlPqY FORQPNAD5h1h7Mg2LNLzQBmenf4aS7j1BD2W81XGOcabuTS9Hb1c7JwCpdEceqL8QpiLXvZ ZotojfZpPyRyZH6EmH6Lek4DREgswKUyajhI7CYjERF9ccdvz1pp1vvZmz+wSvoyrf92QPJ E4OUCIwLtEnfevk7l5T6w== X-UI-Out-Filterresults: notjunk:1; V01:K0:uJFokutPg0Q=:UZf/yUfs1BzmUVNC5KD+r8 B0S36p0xPdGM1AwlX1F19HEKP6AD0rTKxnMsKjVAE3TWInWgOePt1uKbCj6mv3Xpks0Lu/juh 8q7aoVVJLnxtevsWhuS1Ou15mMc9YkBZVI8egovE025+FBGHgS12+D8GNm25H/EHYcyE0RaBC vQJnb4bcnUZI35KMw+tI822ncEK5lBKDd1A+TOgUashai+waP64LIBI5xiXy3D5aNa8DvpKjV 4zeIvH2W27XyvVgqNUlL9QmIgq2zgYwEhA9GHXDCtunyQ2vpRFzwjSF4g3UN3DwuxUmI/5JZd T5GYWbtGV+SXB05ywClGuv5MY7B1jmi41GMGx2njnzP9zzzyZtYulMdupaJJvYmxSAiHkzGJT BCo35l+AFTJIAD5EUd1HTz19nkAibATVIUrlaVDCR7N5TMxw1muYBDTKcDwMZyPSRRZPcK9BM EqK/G9JC0hVO6q3JXD7jRsNoUj5sxV2ye+3PRBVxt5WPJDYLcWitkJNasTyr1APsbVJ4vvKSY eDAQ/euzT6SuhgdmZ2fON00IxwqELXAP3AVTkhlZAfBf9ajzQMUSr27x/xRmZw3th9O1Owuxn eCO8Bgnpu0A99CPT+kHtfDPuoLfQBKzP5G7YvqXni7PvAga3SCfo9ZAJFhIgwCj7nk4zeTpxX 4izNZfs9sjoFELEJ/lUJyZMGNTioKhGFnjrIG43v83cKvata3vdvVhuDLfPB9853HWNthcwyO p3ofH4p0q2XeiJ0Lpl1O8r+IXMCcImJUXolYMPZvKGE9oAoOtUGmZJKcB0M7qTREE5OWGDI5Q TGOWBMc 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: Wed, 12 Oct 2016 09:54:26 +0200 * Move the definition for the variable "ret" into an if branch so that an extra initialisation can be avoided at the beginning by this refactoring. * Return a success code as a constant at the end. Signed-off-by: Markus Elfring --- drivers/media/platform/davinci/vpbe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c index d6a0221..19611a2 100644 --- a/drivers/media/platform/davinci/vpbe.c +++ b/drivers/media/platform/davinci/vpbe.c @@ -297,19 +297,19 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) static int vpbe_set_default_output(struct vpbe_device *vpbe_dev) { struct vpbe_config *cfg = vpbe_dev->cfg; - int ret = 0; int i; for (i = 0; i < cfg->num_outputs; i++) { if (!strcmp(def_output, cfg->outputs[i].output.name)) { - ret = vpbe_set_output(vpbe_dev, i); + int ret = vpbe_set_output(vpbe_dev, i); + if (!ret) vpbe_dev->current_out_index = i; return ret; } } - return ret; + return 0; } /**