Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756654AbbKESvc (ORCPT ); Thu, 5 Nov 2015 13:51:32 -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 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> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1835 Lines: 53 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); + } } } -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/