From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161150AbbKFKJt (ORCPT ); Fri, 6 Nov 2015 05:09:49 -0500 Received: from mx01-fr.bfs.de ([193.174.231.67]:26529 "EHLO mx01-fr.bfs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754933AbbKFKJq (ORCPT ); Fri, 6 Nov 2015 05:09:46 -0500 Message-ID: <563C7C59.8020907@bfs.de> Date: Fri, 06 Nov 2015 11:09:29 +0100 From: walter harms Reply-To: wharms@bfs.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 To: SF Markus Elfring CC: Mauro Carvalho Chehab , Maxime Coquelin , Patrice Chotard , Srinivas Kandagatla , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, kernel@stlinux.com, LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: Re: [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block 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> <563BA50C.4060303@users.sourceforge.net> In-Reply-To: <563BA50C.4060303@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 05.11.2015 19:50, schrieb SF Markus Elfring: > 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 you do "if (!tsin) continue ;" you can save one indent level re, wh > > - 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); > + } > } > } >