From patchwork Thu Nov 5 18:50:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7563451 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 239719F2F7 for ; Thu, 5 Nov 2015 18:51:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D9B220786 for ; Thu, 5 Nov 2015 18:51:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4524A20751 for ; Thu, 5 Nov 2015 18:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751819AbbKESvb (ORCPT ); Thu, 5 Nov 2015 13:51:31 -0500 Received: from mout.web.de ([212.227.15.14]:53885 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751538AbbKESv3 (ORCPT ); Thu, 5 Nov 2015 13:51:29 -0500 Received: from [192.168.1.2] ([78.49.111.82]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MLy84-1Zovyc1AfE-007l5X; Thu, 05 Nov 2015 19:50:54 +0100 Subject: [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block To: Mauro Carvalho Chehab , Maxime Coquelin , Patrice Chotard , Srinivas Kandagatla , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, kernel@stlinux.com References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <563BA3CC.4040709@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <563BA50C.4060303@users.sourceforge.net> Date: Thu, 5 Nov 2015 19:50:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563BA3CC.4040709@users.sourceforge.net> X-Provags-ID: V03:K0:l2OXUZB0f0qibKLuQ50roo2bpGnyIWLzxhKnN+Q/bCwGQBSpDJa rQdStGbsFbkp3m90G4xs+YyH48aCNVW5egBI5gkeki4Dib067jRRbzoUpeIqfVd9X2xrJm+ eDvtMMxU2s5QmmTSax6KGdkmksOdM3sFgiKyFkPcLFQi6dQPe3XJL7eRL62Mu+XTY7hL1MG Kdm0t4l6goYL8wCm8Evmg== X-UI-Out-Filterresults: notjunk:1; V01:K0:9EVjcgDr1ZQ=:qoRoYvs8Vt7EHZrC9cRxKj IUgKV0mXcGbaEwyjxoUcQh+vd/b3FU1qB8xaxAjPlp5a5UK3DqKbXRnTzw2xIhec+kdMx9MIG DH7xStlEECtV2qwUlvnJEvOkc1Ycq/m9nGbdAWeFA5gLk1A7tj4gJ4bcdGo4SvHHkmpqquB3f WG7b0V8tyjb7u7vO7xx3iJxBpOZjsjOXxasbt++0+tQgpO1idNGBiUK8jNi+kbYMSzgVi6jYN dBmLenEW0t/wD/HfXaosAytiLccGhnK01jr/8g+iPuqGeV3+7aXljlHwBrQofidzBUeeNTo4K 4pBFYPtC0NH7a27B77Twt2DpsAMaRW5Ltf2f1lHndBlgPJCg9eDadZ9kLDZznf4we++HajIB5 8NRiAU7UYwwpgs+udHyQGaOXv57l115vt2J3pdaqKs1zRQ/XWJHKT5DQ5pEK9iIC3FZLlppLS S67+2OCOe21SjDg0il8p4L8nCqE5aOp/ZmxB1EaOXQkEL2HC9Sx+E8c/wBGjK9gjE/Vk1SdAA 2FVfCn8/TSLv/5MZ/QxQlXQgk3omsihw7YLqZ+Zmu56OJjI7svuY2XTrhugKwCdsrYChxzvkS mPkCcJLVPdQ8xXPCSym7Of+2J0g/n3VqDOZWg9S6H5gsN+ZIOsKIPTCIpGKeES9udJ2AD/dcn gtNvnQFsCUZ5mNn543q2kLThly1E8czrurMgl2MbWVAtNQJO917EjhWRQJFwmYVLm+4VK+302 AGzv6PCTpOvhim3nT68qJ15smvsR5xBIczibyaOemBFkbmlkbff0YEJCU3fXxBx0UuUfWpBPs KktcCJi Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 5 Nov 2015 19:23:50 +0100 The variable "tsin" was checked three times in a loop iteration of the c8sectpfe_tuner_unregister_frontend() function. This implementation detail could be improved by the combination of the involved statements into a single if block so that this variable will be checked only once there. Signed-off-by: Markus Elfring --- drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c index 07fd6d9..2dfbe8a 100644 --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c @@ -209,17 +209,18 @@ void c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe, tsin = fei->channel_data[n]; - if (tsin && tsin->frontend) { - dvb_unregister_frontend(tsin->frontend); - dvb_frontend_detach(tsin->frontend); - } + if (tsin) { + if (tsin->frontend) { + dvb_unregister_frontend(tsin->frontend); + dvb_frontend_detach(tsin->frontend); + } - if (tsin) i2c_put_adapter(tsin->i2c_adapter); - if (tsin && tsin->i2c_client) { - module_put(tsin->i2c_client->dev.driver->owner); - i2c_unregister_device(tsin->i2c_client); + if (tsin->i2c_client) { + module_put(tsin->i2c_client->dev.driver->owner); + i2c_unregister_device(tsin->i2c_client); + } } }